Declaring a character length from a function inside a module results in an ICE with recent gfortran

Bug #1768702 reported by Thomas Duvernay
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-7 (Ubuntu)
New
Undecided
Unassigned

Bug Description

Hi,

I am running into an ICE when I try to compile a Fortran module inside which the length of a character variable declared in one of the module's functions is set according to the value returned by another function of the same module. This ICE only occurs if the first function mentioned is written before the second one. Using packages from the Bionic repositories, I was able to reproduce the ICE with gfortran 6.4.0, 7.3.0, 8.0.1 and 9.0.0 but not with gfortran 4.8.5 and 5.5.0.
Please find below the terminal outputs and attached a minimal example.

Thomas

thomas@tristan:~/Documents/LearnFortran$ lsb_release -rd
Description: Ubuntu 18.04 LTS
Release: 18.04

thomas@tristan:~/Documents/LearnFortran$ gfortran -v -save-temps -c test.F90
Using built-in specs.
COLLECT_GCC=gfortran
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-16ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --with-as=/usr/bin/x86_64-linux-gnu-as --with-ld=/usr/bin/x86_64-linux-gnu-ld --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/7/f951 test.F90 -cpp=test.f90 -quiet -v -imultiarch x86_64-linux-gnu test.F90 -quiet -dumpbase test.F90 -mtune=generic -march=x86-64 -auxbase test -version -fintrinsic-modules-path /usr/lib/gcc/x86_64-linux-gnu/7/finclude -o test.s
GNU Fortran (Ubuntu 7.3.0-16ubuntu3) version 7.3.0 (x86_64-linux-gnu)
 compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/7/finclude
 /usr/lib/gcc/x86_64-linux-gnu/7/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU Fortran2008 (Ubuntu 7.3.0-16ubuntu3) version 7.3.0 (x86_64-linux-gnu)
 compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-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:1579
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.

Revision history for this message
Thomas Duvernay (patol75) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.