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

            Bug ID: 108056
           Summary: backward compatibility issue between 11 and 12
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gilles.gouaillardet at gmail dot com
  Target Milestone: ---

Created attachment 54062
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54062&action=edit
a simple reproducer

The attached program crashes when compiled on ubuntu 22.04 (jammy) based on
debian bookworm with gfortran-11:

$ gfortran bug.f90 
$ ./a.out 
Internal Error: Invalid type in descriptor

Error termination. Backtrace:
#0  0x7f04aefe9ad0 in ???
#1  0x7f04aefea649 in ???
#2  0x7f04aefeae38 in ???
#3  0x7f04af22c8a4 in ???
#4  0x56490815c24e in ???
#5  0x56490815c1f3 in ???
#6  0x56490815c316 in ???
#7  0x56490815c352 in ???
#8  0x7f04aedc7d8f in __libc_start_call_main
        at ../sysdeps/nptl/libc_start_call_main.h:58
#9  0x7f04aedc7e3f in __libc_start_main_impl
        at ../csu/libc-start.c:392
#10  0x56490815c0c4 in ???
#11  0xffffffffffffffff in ???


After some investigations, I found gfortran-11 uses libgfortran built for
gfortran-12. I guess the fine folks at debian chose to do so since the version
library for libgfortran in 5.0.0 (from gfortran-8 up to gfortran-12, I did not
test gfortran-13) and they assume or expect ABI and semantic compatibility.

The issue can be reproduced by compiling the attached reproducer with
gfortran-11, and running it after tweaking LD_LIBRARY_PATH so it uses
libgfortran from gfortran-12.


I think there are basically two ways to see this issue:
 - it should work, this is a bug in libfrotran-12
 - libgfortran does not ensure such backward compatibility, and because of the
semantic change, the library version should be/have been bumped ( e.g. 5.1.0 or
6.0.0) from gfortran-12.

Once it is decided on how to move forward, I will be more than happy to report
this to the debian folks.

For the records, this issue came to my attention at
https://stackoverflow.com/questions/74738981/the-use-mpi-f08-statement-causes-fortran-mpi-programs-to-crash-on-ubuntu-22-04/74742760#74742760

Reply via email to