[Bug fortran/97799] New: Passing CHARACTER*(*) var(*) through ENTRY causes segfaults

2020-11-11 Thread hockney at jpl dot nasa.gov via Gcc-bugs
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.

[Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults

2020-11-11 Thread hockney at jpl dot nasa.gov via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97799

--- Comment #1 from George Hockney  ---
Created attachment 49549
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49549&action=edit
details.txt -- detailed invocation and outputs

[Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults

2020-11-11 Thread hockney at jpl dot nasa.gov via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97799

George Hockney  changed:

   What|Removed |Added

  Known to work||9.2.0
  Known to fail||10.2.0

--- Comment #2 from George Hockney  ---
Added details.txt attachment and updated Known to work and Known to fail fields

[Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults

2020-11-11 Thread hockney at jpl dot nasa.gov via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97799

George Hockney  changed:

   What|Removed |Added

  Known to work||10.2.1

--- Comment #7 from George Hockney  ---
We have build 10.2.1 20201017 locally and bugtest.f passes.

No warning messages
valgrind says it's OK
runs OK.


We are in process of a major build testing a large-scale legacy software
package, but it looks as if this regression is fixed.

[Bug fortran/97799] Passing CHARACTER*(*) var(*) through ENTRY causes segfaults

2020-11-12 Thread hockney at jpl dot nasa.gov via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97799

George Hockney  changed:

   What|Removed |Added

 Status|RESOLVED|VERIFIED

--- Comment #11 from George Hockney  ---
We've verified a large-scale legacy build against 

GNU Fortran (gcc8.2) 11.0.0 2020 (experimental)

and

GNU Fortran (GCC) 10.2.1 20201017

All our regressions pass these compilers.

Therefore, I'm changing the status to verified (this is per our bugzilla
workflow; if it's not your workflow please fix)



Unfortunately, 10.2.0 was released with this bug.