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

            Bug ID: 86120
           Summary: SIGSEGV without backtrace when using submodules
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon.kluepfel at gmail dot com
  Target Milestone: ---

Created attachment 44264
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44264&action=edit
source code

The attached code does not run as expected when compiling with -O3 using
gfortran 6 and 7. For gfortran-6 a write statement to a file inside the routine
"fixes" the segfault. Works for gfortran-8.

Moving the submodule into the module, or not using the str_set routine avoids
the segfault as well.

compiled with:

gfortran-XXX -O3 -std=f2008 -g -fbacktrace -fcheck=all  string.f03 dt.f03
dt_sub.f03 main.f03

for XXX=
  gcc version 6.4.0 20180424 (Debian 6.4.0-17) 
  gcc version 7.3.0 (Debian 7.3.0-21) 
  gcc version 8.1.0 (Debian 8.1.0-5) 

output expected / v. 8: 
$ ./a.out 
           1           2
           1           2
           1           2
$

v. 7:
$ ./a.out 
           1           2
           1           2

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f8c0df6e0fd in ???
#1  0x7f8c0df6d343 in ???
#2  0x7f8c0d3e2eff in ???
#3  0x0 in ???
Segmentation fault

v. 6:
$ ./a.out 
           1           2

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f1cbf72dced in ???
#1  0x7f1cbf72cf4d in ???
#2  0x7f1cbeba1eff in ???
#3  0x0 in ???
Segmentation fault

Reply via email to