https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80595
Bug ID: 80595 Summary: [OOP] ICE using allocate with mold Product: gcc Version: 6.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: stefan.frijters at vortech dot nl Target Milestone: --- The following example produces an ICE/segfault on gfortran 6.1.1, as well as gfortran 5.4.0: module ice type iceObject end type type :: iceObjectPtr type(iceObject), allocatable :: ptr end type type :: iceObjects private type(iceObjectPtr), allocatable :: objects(:) end type contains subroutine ice_create(this, mold) class(iceObjects) :: this class(iceObject) :: mold allocate( this%objects(1)%ptr, mold=mold ) end subroutine end module Driving: gfortran -v -save-temps ice.f90 -l gfortran -l m -shared-libgcc Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.1.1-3ubuntu11~14.04.1' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --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=gcc4-compatible --disable-libstdcxx-dual-abi --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --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-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-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 --enable-multilib --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 6.1.1 20160511 (Ubuntu 6.1.1-3ubuntu11~14.04.1) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-linux-gnu/6/f951 ice.f90 -quiet -dumpbase ice.f90 -mtune=generic -march=x86-64 -auxbase ice -version -fintrinsic-modules-path /usr/lib/gcc/x86_64-linux-gnu/6/finclude -o ice.s GNU Fortran (Ubuntu 6.1.1-3ubuntu11~14.04.1) version 6.1.1 20160511 (x86_64-linux-gnu) compiled by GNU C version 6.1.1 20160511, GMP version 5.1.3, MPFR version 3.1.3, MPC version 1.0.1, isl version 0.15 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU Fortran2008 (Ubuntu 6.1.1-3ubuntu11~14.04.1) version 6.1.1 20160511 (x86_64-linux-gnu) compiled by GNU C version 6.1.1 20160511, GMP version 5.1.3, MPFR version 3.1.3, MPC version 1.0.1, isl version 0.15 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ice.f90:20:0: allocate( this%objects(1)%ptr, mold=mold ) internal compiler error: Segmentation fault 0xa454cf crash_signal ../../src/gcc/toplev.c:333 0x68b90e gfc_class_vptr_get(tree_node*) ../../src/gcc/fortran/trans-expr.c:151 0x68f309 class_vtab_field_get ../../src/gcc/fortran/trans-expr.c:222 0x68f309 gfc_class_vtab_copy_get(tree_node*) ../../src/gcc/fortran/trans-expr.c:244 0x68f309 gfc_copy_class_to_class(tree_node*, tree_node*, tree_node*, bool) ../../src/gcc/fortran/trans-expr.c:1116 0x6c96e4 gfc_trans_allocate(gfc_code*) ../../src/gcc/fortran/trans-stmt.c:6137 0x664b47 trans_code ../../src/gcc/fortran/trans.c:1840 0x68814c gfc_generate_function_code(gfc_namespace*) ../../src/gcc/fortran/trans-decl.c:6154 0x6680b1 gfc_generate_module_code(gfc_namespace*) ../../src/gcc/fortran/trans.c:2058 0x620bcd translate_all_program_units ../../src/gcc/fortran/parse.c:5600 0x620bcd gfc_parse_file() ../../src/gcc/fortran/parse.c:5819 0x661f02 gfc_be_parse_file ../../src/gcc/fortran/f95-lang.c:201