[Bug 1768702] [NEW] Declaring a character length from a function inside a module results in an ICE with recent gfortran

Thomas Duvernay 1768702 at bugs.launchpad.net
Thu May 3 02:17:46 UTC 2018


Public bug reported:

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 at tristan:~/Documents/LearnFortran$ lsb_release -rd
Description:	Ubuntu 18.04 LTS
Release:	18.04

thomas at 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.

** Affects: gcc-7 (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "Minimal example"
   https://bugs.launchpad.net/bugs/1768702/+attachment/5132628/+files/test.F90

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-7 in Ubuntu.
https://bugs.launchpad.net/bugs/1768702

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

Status in gcc-7 package in Ubuntu:
  New

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 at tristan:~/Documents/LearnFortran$ lsb_release -rd
  Description:	Ubuntu 18.04 LTS
  Release:	18.04

  thomas at 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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-7/+bug/1768702/+subscriptions



More information about the foundations-bugs mailing list