public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/106295] New: INQUIRE statement bus error at runtime
@ 2022-07-14 13:09 ghlixo at gmail dot com
  2022-07-14 13:11 ` [Bug libfortran/106295] " ghlixo at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ghlixo at gmail dot com @ 2022-07-14 13:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106295

            Bug ID: 106295
           Summary: INQUIRE statement bus error at runtime
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ghlixo at gmail dot com
  Target Milestone: ---

Created attachment 53296
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53296&action=edit
Main program (to be compiled with latest release, e.g. 11.2.0)

Fortran subroutine using INQUIRE(UNIT=..., OPENED=...) compiled with gfortran
4.9.2 fails with bus error when linked by gfortran 11.2.0 to main program. 
Works OK if subroutine recompiled with gfortran 11.2.0; clearly a run-time
library version skew; possibly a library versioning bug.

If not a bug, and instead a fact of life of libfortran evolution, there should
be better user-level documentation of when library incompatibilities happen,
ideally in the gfortran/news wiki.  Then those who provide subroutine packages
for general use can alert their users of runtime library compatibility issues. 
The only gfortran documentation I've seen discussing library version
incompatibilities is in

https://gcc.gnu.org/wiki/LibgfortranAbiCleanup

which mentions the ABI being broken in version 7 and again in version 8; I
wouldn't quite call this user-level information. 

Target:  x86_64-apple-darwin18.7.0

Debug output:
#/usr/local/bin/gfortran -g -c -o /tmp/inqtest.o /tmp/inqtest.f  # gfortran
4.9.2
#gfortran -g -o /tmp/inqmain /tmp/inqmain.o /tmp/inqtest.o       # gfortran
11.2.0
#gdb /tmp/inqmain
GNU gdb (GDB) 9.2-macos-20220204
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin18.7.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /tmp/inqmain...
(gdb) run
Starting program: /private/tmp/inqmain 
[New Thread 0x2603 of process 92337]
[New Thread 0x1803 of process 92337]
[New Thread 0x2303 of process 92337]

Thread 3 received signal SIGBUS, Bus error.
0x00000001002e6fe5 in ?? () from /opt/gfortran/lib/libgfortran.5.dylib
(gdb) where
#0  0x00000001002e6fe5 in ?? () from /opt/gfortran/lib/libgfortran.5.dylib
#1  0x00000001002e7f35 in ?? () from /opt/gfortran/lib/libgfortran.5.dylib
#2  0x0000000100000d55 in zgtfun (nfun=19, nerr=0) at /tmp/inqtest.f:10
#3  0x0000000100000c83 in MAIN__ () at /tmp/inqmain.f:6
(gdb) up
#1  0x00000001002e7f35 in ?? () from /opt/gfortran/lib/libgfortran.5.dylib
(gdb) up
#2  0x0000000100000d55 in zgtfun (nfun=19, nerr=0) at /tmp/inqtest.f:10
10              inquire(unit=nfun,opened=lopen)
(gdb) q
A debugging session is active.

        Inferior 1 [process 92337] will be killed.

Quit anyway? (y or n) y
#

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libfortran/106295] INQUIRE statement bus error at runtime
  2022-07-14 13:09 [Bug libfortran/106295] New: INQUIRE statement bus error at runtime ghlixo at gmail dot com
@ 2022-07-14 13:11 ` ghlixo at gmail dot com
  2022-07-14 13:12 ` ghlixo at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ghlixo at gmail dot com @ 2022-07-14 13:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106295

--- Comment #1 from ghlixo at gmail dot com ---
Created attachment 53297
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53297&action=edit
main program (to be compiled with latest release, e.g. 11.2.0)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libfortran/106295] INQUIRE statement bus error at runtime
  2022-07-14 13:09 [Bug libfortran/106295] New: INQUIRE statement bus error at runtime ghlixo at gmail dot com
  2022-07-14 13:11 ` [Bug libfortran/106295] " ghlixo at gmail dot com
@ 2022-07-14 13:12 ` ghlixo at gmail dot com
  2022-07-14 13:13 ` ghlixo at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ghlixo at gmail dot com @ 2022-07-14 13:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106295

--- Comment #2 from ghlixo at gmail dot com ---
Created attachment 53298
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53298&action=edit
subroutine (to be compiled with older libfortran)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libfortran/106295] INQUIRE statement bus error at runtime
  2022-07-14 13:09 [Bug libfortran/106295] New: INQUIRE statement bus error at runtime ghlixo at gmail dot com
  2022-07-14 13:11 ` [Bug libfortran/106295] " ghlixo at gmail dot com
  2022-07-14 13:12 ` ghlixo at gmail dot com
@ 2022-07-14 13:13 ` ghlixo at gmail dot com
  2022-07-14 18:37 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ghlixo at gmail dot com @ 2022-07-14 13:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106295

--- Comment #3 from ghlixo at gmail dot com ---
That first attachment contains both parts of the code (main, subroutine).  The
later ones are the individual pieces.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libfortran/106295] INQUIRE statement bus error at runtime
  2022-07-14 13:09 [Bug libfortran/106295] New: INQUIRE statement bus error at runtime ghlixo at gmail dot com
                   ` (2 preceding siblings ...)
  2022-07-14 13:13 ` ghlixo at gmail dot com
@ 2022-07-14 18:37 ` anlauf at gcc dot gnu.org
  2024-03-06  2:49 ` jvdelisle at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-07-14 18:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106295

--- Comment #4 from anlauf at gcc dot gnu.org ---
I think the fix for PR83036 (INQUIRE specifier NEXTREC is a 4-byte integer,
should be 8), which changed the layout of struct st_parameter_inquire,
could explain what you observe.

I have no solution to your problem other than recommending not doing what
you did: mix vastly different compiler versions with legacy code.  You would
have been warned if you used modern Fortran with modules.

I bet that most other compilers require (recommend or advise) recompilation
of legacy code without explaining in detail which intrinsic might be affected.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libfortran/106295] INQUIRE statement bus error at runtime
  2022-07-14 13:09 [Bug libfortran/106295] New: INQUIRE statement bus error at runtime ghlixo at gmail dot com
                   ` (3 preceding siblings ...)
  2022-07-14 18:37 ` anlauf at gcc dot gnu.org
@ 2024-03-06  2:49 ` jvdelisle at gcc dot gnu.org
  2024-03-19 16:07 ` ghlixo at gmail dot com
  2024-03-19 17:22 ` jvdelisle at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2024-03-06  2:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106295

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
                 CC|                            |jvdelisle at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
I think this should be closed. Dont mix libraries.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libfortran/106295] INQUIRE statement bus error at runtime
  2022-07-14 13:09 [Bug libfortran/106295] New: INQUIRE statement bus error at runtime ghlixo at gmail dot com
                   ` (4 preceding siblings ...)
  2024-03-06  2:49 ` jvdelisle at gcc dot gnu.org
@ 2024-03-19 16:07 ` ghlixo at gmail dot com
  2024-03-19 17:22 ` jvdelisle at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: ghlixo at gmail dot com @ 2024-03-19 16:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106295

--- Comment #6 from ghlixo at gmail dot com ---
One last comment about this issue.

I maintain and distribute a Fortran subroutine package to users.  In my
experience, most of them are unaware that Fortran compilers evolve over time,
and that the compiler used to build the subroutine package might not be the
same version that they have installed.

It seems that simple form of link-time version control might alert them to the
problem, and avoid spurious problem reports.  Would not a reference to a symbol
in the run-time library dropped into compiled code when a library routine is
used solve the problem?  If the symbol definition changes when the library
changes, then it would be impossible to link old code with an incompatible
run-time library.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libfortran/106295] INQUIRE statement bus error at runtime
  2022-07-14 13:09 [Bug libfortran/106295] New: INQUIRE statement bus error at runtime ghlixo at gmail dot com
                   ` (5 preceding siblings ...)
  2024-03-19 16:07 ` ghlixo at gmail dot com
@ 2024-03-19 17:22 ` jvdelisle at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2024-03-19 17:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106295

--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
I don't think that is a bad idea. I realize that this comes up often enough to
consider some solution.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-03-19 17:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14 13:09 [Bug libfortran/106295] New: INQUIRE statement bus error at runtime ghlixo at gmail dot com
2022-07-14 13:11 ` [Bug libfortran/106295] " ghlixo at gmail dot com
2022-07-14 13:12 ` ghlixo at gmail dot com
2022-07-14 13:13 ` ghlixo at gmail dot com
2022-07-14 18:37 ` anlauf at gcc dot gnu.org
2024-03-06  2:49 ` jvdelisle at gcc dot gnu.org
2024-03-19 16:07 ` ghlixo at gmail dot com
2024-03-19 17:22 ` jvdelisle at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).