[Bug fortran/87644] New: ICE due to variable named "parameters"
matthew.thompson at nasa dot gov
gcc-bugzilla@gcc.gnu.org
Thu Oct 18 15:34:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87644
Bug ID: 87644
Summary: ICE due to variable named "parameters"
Product: gcc
Version: 8.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: matthew.thompson at nasa dot gov
Target Milestone: ---
This is a weird ICE recently encountered using gfortran 8.2.0 on SLES11, CentOS
7, and macOS High Sierra in a large code, but I managed to whittle it down to a
small reproducer below. The issue sees to be related to the fact that the
variable is named 'parameters'.
module test
implicit none
private
public :: get
contains
subroutine initialize()
integer :: parameters
parameters = get()
end subroutine initialize
function get() result(parameters)
integer :: parameters
parameters = 1
end function get
end module test
When it's compiled:
(259) $ gfortran -v -save-temps test.F90
Driving: gfortran -v -save-temps test.F90 -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/ford1/local/gcc/gcc-8.2.0/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-8.2.0/configure --prefix=/ford1/local/gcc/gcc-8.2.0
--disable-multilib
Thread model: posix
gcc version 8.2.0 (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
/ford1/local/gcc/gcc-8.2.0/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/f951 test.F90
-cpp=test.f90 -quiet -v test.F90 -quiet -dumpbase test.F90 -mtune=generic
-march=x86-64 -auxbase test -version -fintrinsic-modules-path
/ford1/local/gcc/gcc-8.2.0/lib/gcc/x86_64-pc-linux-gnu/8.2.0/finclude -o test.s
GNU Fortran (GCC) version 8.2.0 (x86_64-pc-linux-gnu)
compiled by GNU C version 8.2.0, GMP version 6.1.0, MPFR version 3.1.4,
MPC version 1.0.3, isl version isl-0.18-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/ford1/local/gcc/gcc-8.2.0/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/ford1/local/gcc/gcc-8.2.0/lib/gcc/x86_64-pc-linux-gnu/8.2.0/finclude
/ford1/local/gcc/gcc-8.2.0/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include
/usr/local/include
/ford1/local/gcc/gcc-8.2.0/include
/ford1/local/gcc/gcc-8.2.0/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include-fixed
/usr/include
End of search list.
GNU Fortran2008 (GCC) version 8.2.0 (x86_64-pc-linux-gnu)
compiled by GNU C version 8.2.0, GMP version 6.1.0, MPFR version 3.1.4,
MPC version 1.0.3, isl version isl-0.18-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
f951: internal compiler error: in is_illegal_recursion, at
fortran/resolve.c:1684
0x5c3d20 is_illegal_recursion
../../gcc-8.2.0/gcc/fortran/resolve.c:1684
0x6a3136 resolve_function
../../gcc-8.2.0/gcc/fortran/resolve.c:3262
0x6a006d gfc_resolve_expr(gfc_expr*)
../../gcc-8.2.0/gcc/fortran/resolve.c:6725
0x633cff gfc_reduce_init_expr(gfc_expr*)
../../gcc-8.2.0/gcc/fortran/expr.c:2773
0x636650 gfc_match_init_expr(gfc_expr**)
../../gcc-8.2.0/gcc/fortran/expr.c:2821
0x6203b4 do_parm
../../gcc-8.2.0/gcc/fortran/decl.c:8836
0x6203b4 gfc_match_parameter()
../../gcc-8.2.0/gcc/fortran/decl.c:8890
0x67f239 match_word
../../gcc-8.2.0/gcc/fortran/parse.c:65
0x67fbac decode_statement
../../gcc-8.2.0/gcc/fortran/parse.c:356
0x68357e next_free
../../gcc-8.2.0/gcc/fortran/parse.c:1234
0x68357e next_statement
../../gcc-8.2.0/gcc/fortran/parse.c:1466
0x684c2b parse_spec
../../gcc-8.2.0/gcc/fortran/parse.c:3858
0x687627 parse_progunit
../../gcc-8.2.0/gcc/fortran/parse.c:5671
0x687aaa parse_contained
../../gcc-8.2.0/gcc/fortran/parse.c:5574
0x68871c parse_module
../../gcc-8.2.0/gcc/fortran/parse.c:5944
0x688a0b gfc_parse_file()
../../gcc-8.2.0/gcc/fortran/parse.c:6247
0x6cf25f gfc_be_parse_file
../../gcc-8.2.0/gcc/fortran/f95-lang.c:204
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Note that if the variable 'parameters' is renamed 'p' it works:
(261) $ cat testp.F90
module test
implicit none
private
public :: get
contains
subroutine initialize()
integer :: p
p = get()
end subroutine initialize
function get() result(p)
integer :: p
p = 1
end function get
end module test
(262) $ gfortran testp.F90
/lib/../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
More information about the Gcc-bugs
mailing list