[Bug fortran/87352] New: Large stack usage with new gfortran
jeremy at jeremysanders dot net
gcc-bugzilla@gcc.gnu.org
Tue Sep 18 12:34:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87352
Bug ID: 87352
Summary: Large stack usage with new gfortran
Product: gcc
Version: 8.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: jeremy at jeremysanders dot net
Target Milestone: ---
Created attachment 44718
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44718&action=edit
Affected module and example main program
With gcc/gfortran 7.3 and 8.2, creation of a variable in the main program with
a particular type defined in a module (attached) leads to a segfault due to
very large stack usage. This worked on gcc 4.8.4 and earlier versions.
In addition compilation of the module creates an object file which is x10000
times larger than for earlier gcc versions (200MB vs 25KB). With optimization
(-O2), the compilation time is several minutes, rather than less than a second.
Instructions for compilation:
$ gfortran -ffixed-line-length-none -ffree-line-length-none -g -O2 -o testcomb
testcomb.f90
testcomb.f90:1303:0:
end module testmodule
note: variable tracking size limit exceeded with -fvar-tracking-assignments,
retrying without
$ ./testcomb
$ gdb ./testcomb
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
...
(gdb) run
Starting program: /home/jsanders/tmp/foo/testcomb
Program received signal SIGSEGV, Segmentation fault.
testprog () at testcomb.f90:1309
1309 type(instlist_type),target :: instlist
It works if the stack is increased to 819200.
This problem is seen using Ubuntu Bionic (18.04) on x86-64, using the built-in
gcc (7.3.0), or a self-compiled version (8.2.0) with no special build options.
More information about the Gcc-bugs
mailing list