http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47767
Summary: SELECT TYPE fails to execute correct TYPE IS block
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 23363
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23363
Test case to reproduce the bug.
The attached code should execute the contents of the TYPE IS block and print
"correct", but fails to do so, falling through to the CLASS DEFAULT block and
printing "incorrect".
There are a number of ways to avoid the bug and get the output 'correct':
* removing the 'private' statement
* removing the 'public' statement
* removing the 'baseNode' component
* removing the unneeded module 'merger_tree_build'
Compiled using r170207 of gfortran 4.6.0
$ gfortran selectTypeFail.F90 -o selectTypeFail.exe -g -fbacktrace -v
Driving: gfortran selectTypeFail.F90 -o selectTypeFail.exe -g -fbacktrace -v -l
gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.6/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++,fortran --disable-multilib --with-gmp=/usr/local
--with-mpc=/usr/local --with-mpfr=/usr/local
Thread model: posix
gcc version 4.6.0 20110216 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-o' 'selectTypeFail.exe' '-g' '-fbacktrace' '-v'
'-shared-libgcc' '-mtune=generic' '-march=pentiumpro'
/usr/local/gcc-trunk/libexec/gcc/i686-pc-linux-gnu/4.6.0/f951
selectTypeFail.F90 -cpp=/tmp/ccro8Gvw.f90 -quiet -v selectTypeFail.F90 -quiet
-dumpbase selectTypeFail.F90 -mtune=generic -march=pentiumpro -auxbase
selectTypeFail -g -version -fbacktrace -fintrinsic-modules-path
/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/finclude -o
/tmp/ccguPzRS.s
GNU Fortran (GCC) version 4.6.0 20110216 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 4.6.0 20110216 (experimental), GMP version
4.3.2, MPFR version 3.0.0, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory
"/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/finclude
/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/include
/usr/local/include
/usr/local/gcc-trunk/include
/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/include-fixed
/usr/include
End of search list.
GNU Fortran (GCC) version 4.6.0 20110216 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 4.6.0 20110216 (experimental), GMP version
4.3.2, MPFR version 3.0.0, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
COLLECT_GCC_OPTIONS='-o' 'selectTypeFail.exe' '-g' '-fbacktrace' '-v'
'-shared-libgcc' '-mtune=generic' '-march=pentiumpro'
as --32 -o /tmp/ccZqndJg.o /tmp/ccguPzRS.s
Reading specs from
/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../libgfortran.spec
rename spec lib to liborig
COLLECT_GCC_OPTIONS='-o' 'selectTypeFail.exe' '-g' '-fbacktrace' '-v'
'-shared-libgcc' '-mtune=generic' '-march=pentiumpro'
COMPILER_PATH=/usr/local/gcc-trunk/libexec/gcc/i686-pc-linux-gnu/4.6.0/:/usr/local/gcc-trunk/libexec/gcc/i686-pc-linux-gnu/4.6.0/:/usr/local/gcc-trunk/libexec/gcc/i686-pc-linux-gnu/:/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/:/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/
LIBRARY_PATH=/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/:/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-o' 'selectTypeFail.exe' '-g' '-fbacktrace' '-v'
'-shared-libgcc' '-mtune=generic' '-march=pentiumpro'
/usr/local/gcc-trunk/libexec/gcc/i686-pc-linux-gnu/4.6.0/collect2
--eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o
selectTypeFail.exe /usr/lib/crt1.o /usr/lib/crti.o
/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/crtbegin.o
-L/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0
-L/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/../../.. /tmp/ccZqndJg.o
-lgfortran -lm -lgcc_s -lgcc -lquadmath -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/local/gcc-trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/crtend.o /usr/lib/crtn.o
$ selectTypeFail.exe
incorrect