https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97799
Bug ID: 97799 Summary: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: hockney at jpl dot nasa.gov Target Milestone: --- Created attachment 49548 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49548&action=edit bugtest.f -- program evincing bug When a character(*)* var(*) is passed to a subroutine through an entry point in another subroutine, gfortran 10.2.0 generates an exectuable which segfaults in a probablistic way. This is probably related to a warning about an internally generated variable being used uninitialized. The warning and error do not occur in gfortran 9.2.0 The attached file bugtest.f evinces this behavior. The attached file details.txt shows the exact compilition flags to reproduce the failure, and also the resulting backtrace. The exact combination of compilation flags matters. All of them produce the warning about carray.0 but some of them both work and pass our valgrind test: gfortran -Wall -g -S bugtest.f; gfortran bugtest.s -o bugtest # fail gfortran -g bugtest.f -o bugtest # fail gfortran -O1 bugtest.f -o bugtest # fail gfortran -O2 bugtest.f -o bugtest # ok gfortran -O3 bugtest.f -o bugtest # ok gfortran -O2 -fPIC bugtest.f -o bugtest # fail gfortran -O3 -fPIC bugtest.f -o bugtest # fail The valgrind error trace for the errors is: ==32181== Conditional jump or move depends on uninitialised value(s) ==32181== at 0x401438: master.0.top_entry_ (bugtest.f:53) ==32181== by 0x40141B: char_entry_ (bugtest.f:49) ==32181== by 0x40148F: MAIN__ (bugtest.f:6) ==32181== by 0x401698: main (bugtest.f:12) gfortran 9.2.0 does not evince this bug.