ICE in gfc_enforce_clean_symbol_state, at fortran/symbol.c:4273

Bug #1851644 reported by William Daniau
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-9 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

The following f90 file :

$ cat test.f90
module test
contains
function matimul(a,b)
    implicit none
    real(kind=4), dimension(:,:),intent(in) :: a,b
    real(kind=4), dimension(size(a,1),size(b,2)) :: matimul
    matimul=matmul(a,b)
end function
end module test

compiled with flags '-O2 -fexternal-blas' give the following ICE :

$ gfortran -c test.f90 -O2 -fexternal-blas -o test.o
f951: internal compiler error: in gfc_enforce_clean_symbol_state, at fortran/symbol.c:4273
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.

It is the combination of a matmul used in a module and compiled with both flags '-O2' and '-fexternal-blas' which trigger this error. This error did not occur with previous gcc versions.

$ lsb_release -rd
Description: Ubuntu 19.10
Release: 19.10

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.2.1-9ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --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 --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=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,hsa --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 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2)

Revision history for this message
William Daniau (wdaniau) wrote :

This bug is the same as the following on gcc bugzilla

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

and comment #3 gives a workaround :
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92321#c3

using -fno-frontend-optimize on the compilation line will remove the error at the price of some inlining optimizations.

Revision history for this message
William Daniau (wdaniau) wrote :

According to gcc bugzilla, it is fixed now.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92321#c8

Revision history for this message
Matthias Klose (doko) wrote :

fixed

Changed in gcc-9 (Ubuntu):
status: New → Fix Released
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.