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

            Bug ID: 78395
           Summary: [OOP] ICE for operations with polymorphic variables
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cmacmackin at gmail dot com
  Target Milestone: ---

Created attachment 40066
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40066&action=edit
Minimal code producing ICE.

While trying to produce a minimal example for an issue I've been having with
gfortran seeming to misidentify return types when I chain togethor certain
type-bound operators, I came across this ICE. I've attached the code which
produces the ICE. gfortran seems to run into trouble when parsing return types
for line 132. When I perform the same operations using non-polymorphic
variabels (as in line 131) there is no issue.

I am using a self-compiled gfortran-6 binary (compiled against the OpenCoarrays
library, although I'm not using any coarray features). Running "gfortran -v
minimal-abstract.f90" produces

Driving: gfortran -v minimal-abstract.f90 -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/macmackin/.local/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/configure
--prefix=/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/installations/gcc/6.1.0
--enable-languages=c,c++,fortran,lto --disable-multilib --disable-werror
Thread model: posix
gcc version 6.1.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /home/macmackin/.local/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0/f951
minimal-abstract.f90 -quiet -dumpbase minimal-abstract.f90 -mtune=generic
-march=x86-64 -auxbase minimal-abstract -version -fintrinsic-modules-path
/home/macmackin/.local/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/finclude -o
/tmp/macmackin/ccMxUT4H.s
GNU Fortran (GCC) version 6.1.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 6.1.0, GMP version 4.3.2, MPFR version 2.4.2,
MPC version 0.8.1, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran2008 (GCC) version 6.1.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 6.1.0, GMP version 4.3.2, MPFR version 2.4.2,
MPC version 0.8.1, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
f951: internal compiler error: in gfc_add_component_ref, at fortran/class.c:245
0x60aaae gfc_add_component_ref(gfc_expr*, char const*)
       
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/gcc/fortran/class.c:245
0x67f528 resolve_typebound_function
       
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/gcc/fortran/resolve.c:6008
0x67f528 gfc_resolve_expr(gfc_expr*)
       
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/gcc/fortran/resolve.c:6351
0x631e1a gfc_extend_expr(gfc_expr*)
       
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/gcc/fortran/interface.c:3836
0x67f147 resolve_operator
       
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/gcc/fortran/resolve.c:3844
0x67f147 gfc_resolve_expr(gfc_expr*)
       
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/gcc/fortran/resolve.c:6333
0x685933 gfc_resolve_code(gfc_code*, gfc_namespace*)
       
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/gcc/fortran/resolve.c:10437
0x6880e2 resolve_codes
       
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/gcc/fortran/resolve.c:15554
0x6881d1 gfc_resolve(gfc_namespace*)
       
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/gcc/fortran/resolve.c:15588
0x6739da resolve_all_program_units
       
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/gcc/fortran/parse.c:5552
0x6739da gfc_parse_file()
       
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/gcc/fortran/parse.c:5804
0x6b4d15 gfc_be_parse_file
       
/home/macmackin/Code/OpenCoarrays-1.7.2/prerequisites/downloads/gcc-6.1.0/gcc/fortran/f95-lang.c:201
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


When I try compiling the same file with gfortran-4.8 I get

Driving: gfortran-4.8 -v minimal-abstract.f90 -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran-4.8
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.8.4-2ubuntu1~14.04.3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) 
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.8/f951 minimal-abstract.f90 -quiet -dumpbase
minimal-abstract.f90 -mtune=generic -march=x86-64 -auxbase minimal-abstract
-version -fintrinsic-modules-path /usr/lib/gcc/x86_64-linux-gnu/4.8/finclude -o
/tmp/macmackin/cctsBbzF.s
GNU Fortran (Ubuntu 4.8.4-2ubuntu1~14.04.3) version 4.8.4 (x86_64-linux-gnu)
        compiled by GNU C version 4.8.4, GMP version 5.1.3, MPFR version
3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (Ubuntu 4.8.4-2ubuntu1~14.04.3) version 4.8.4 (x86_64-linux-gnu)
        compiled by GNU C version 4.8.4, GMP version 5.1.3, MPFR version
3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
f951: internal compiler error: in gfc_add_component_ref, at fortran/class.c:227
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.

Reply via email to