This piece of (valid) code generates an ICE. When the private attribute to the module is removed a different error occurs (which is also submitted as a bug). troogle> gfortran -v -c n3.f95 Reading specs from /OPT/32/gcc-2004-06-09/lib/gcc/hppa2.0w-hp-hpux11.11/3.5. 0/specs Configured with: ../configure --enable-languages=c,f95 --prefix=/opt32/gcc-2004-06-09 --with-gmp=/opt32/gmp --with-gnu-as --with-as=/opt32/binutils/bin/as --enable-threads --disable-shared --disable-nls Thread model: posix gcc version 3.5.0 20040611 (experimental) /OPT/32/gcc-2004-06-09/libexec/gcc/hppa2.0w-hp-hpux11.11/3.5.0/f951 n3.f95 -quiet -dumpbase n3.f95 -auxbase n3 -version -o /var/tmp//ccOOpnv6.s GNU F95 version 3.5.0 20040611 (experimental) (hppa2.0w-hp-hpux11.11) compiled by GNU C version 3.5.0 20040611 (experimental). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 n3.f95: In function `uppercase': n3.f95:0: internal compiler error: in make_decl_rtl, at varasm.c:758 module theflib private contains !******************************************************************************* function uppercase(string) implicit none character(*), intent(in) :: string character(len(string)) :: uppercase uppercase = string end function uppercase !******************************************************************************* end module theflib
Confirmed.
Failure here: /* Check that we are not being given an automatic variable. */ /* A weak alias has TREE_PUBLIC set but not the other bits. */ if (TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == RESULT_DECL || (TREE_CODE (decl) == VAR_DECL && !TREE_STATIC (decl) && !TREE_PUBLIC (decl) && !DECL_EXTERNAL (decl) && !DECL_REGISTER (decl))) abort ();
gcc 3.4.0 is also affected, here's an alternative snippet: struct S { double d; int i; }; S f () { double a = 0.0; S b = { a, 0 }; return b; } void g () { f(); } $ g++ -O7 -c t.cpp t.cpp: In function `void g()': t.cpp:9: internal compiler error: in make_decl_rtl, at varasm.c:752 $ g++ -v Reading specs from d:/mingw/bin/../lib/gcc/mingw32/3.4.0/specs Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization Thread model: win32 gcc version 3.4.0 (mingw special) gcc 3.2.3 is not affected: eelis@s2:~$ g++ -O7 -c t.cpp eelis@s2:~$ g++ -v Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/specs Configured with: ../gcc-3.2.3/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i486-slackware-linux --host=i486-slackware-linux Thread model: posix gcc version 3.2.3
gccbugs@contacts.eelis.net, your bug is PR15461 and not this one, this is a bug in the new fortran front-end.
Closing as a dup of bug 16609 which has a small example. *** This bug has been marked as a duplicate of 16609 ***