https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77828
Bug ID: 77828
Summary: [7 Regression] Linking gfortran-7 compiled program
with libgfortran of 5.x allowed but crashes when
containing write to string
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
Assignee: unassigned at gcc dot gnu.org
Reporter: vehre at gcc dot gnu.org
Target Milestone: ---
Created attachment 39737
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39737&action=edit
Standalone code as given in the description.
Compiling this example:
character(len=100) :: gr
integer :: i, j
i =42
j =43
write (gr,"(2(a,i2))") "Greetings from i ",i," of ", j
print *,gr
end
using latest gfortran but executing with a (system-provided) libgfortran from a
gcc 5.3.1 in the library search path leads to a segmentation fault on
Linux-x86_64/f23.
It looks like writing to the string corrupts the stack. Has something in the
handling of writing to the string changed, which corrupts the stack? When
linking with a gcc-7 libgfortran everything is fine. May be the libraries
should be made link-incompatible to prevent users searching this issue for
hours (like me) and quite early get a notion what might be the problem. Or is
this issue unintentional?