The following invalid testcase produces and ICE with current trunk. > cat bug.f90 MODULE kinds INTEGER, PARAMETER :: dp=8,int_8=8 END MODULE MODULE realspace_grid_types USE kinds, ONLY: dp, int_8 PUBLIC :: realspace_grid_type,& realspace_grid_input_type END TYPE realspace_grid_desc_type TYPE realspace_grid_desc_p_type TYPE(realspace_grid_desc_type), POINTER :: rs_desc END TYPE realspace_grid_desc_p_type CONTAINS SUBROUTINE rs_grid_create_descriptor ( desc, pw_grid, input_settings, error) TYPE(realspace_grid_input_type), & IF ( pw_grid % para % mode == PW_MODE_LOCAL ) THEN END SUBROUTINE END MODULE realspace_grid_types > gfortran -v bug.f90 Driving: gfortran -v bug.f90 -l gfortran -l m -shared-libgcc Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/data/vjoost/gnu/gcc_trunk/install/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc/configure --prefix=/data/vjoost/gnu/gcc_trunk/install --enable-languages=c,c++,fortran --disable-multilib --enable-plugins --enable-lto --disable-bootstrap Thread model: posix gcc version 4.9.0 20130321 (experimental) [trunk revision 196847] (GCC) COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /data/vjoost/gnu/gcc_trunk/install/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/f951 bug.f90 -quiet -dumpbase bug.f90 -mtune=generic -march=x86-64 -auxbase bug -version -fintrinsic-modules-path /data/vjoost/gnu/gcc_trunk/install/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/finclude -o /tmp/ccaTm8lw.s GNU Fortran (GCC) version 4.9.0 20130321 (experimental) [trunk revision 196847] (x86_64-unknown-linux-gnu) compiled by GNU C version 4.7.2 20120816 (prerelease) [gcc-4_7-branch revision 190437], GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU Fortran (GCC) version 4.9.0 20130321 (experimental) [trunk revision 196847] (x86_64-unknown-linux-gnu) compiled by GNU C version 4.7.2 20120816 (prerelease) [gcc-4_7-branch revision 190437], GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 bug.f90:8.5: END TYPE realspace_grid_desc_type 1 Error: Expecting END MODULE statement at (1) bug.f90:14.35: TYPE(realspace_grid_input_type), & 1 Error: Derived type 'realspace_grid_input_type' at (1) is being used before it is defined bug.f90:10.55: TYPE(realspace_grid_desc_type), POINTER :: rs_desc 1 Error: The pointer component 'rs_desc' of 'realspace_grid_desc_p_type' at (1) is a type that has not been declared f951: internal compiler error: Segmentation fault 0x994a0f crash_signal ../../gcc/gcc/toplev.c:332 0x55650b show_locus ../../gcc/gcc/fortran/error.c:310 0x556d77 error_print ../../gcc/gcc/fortran/error.c:666 0x5573a8 gfc_error(char const*, ...) ../../gcc/gcc/fortran/error.c:961 0x55fda7 check_interface0 ../../gcc/gcc/fortran/interface.c:1469 0x562194 check_sym_interfaces ../../gcc/gcc/fortran/interface.c:1581 0x5c8023 do_traverse_symtree ../../gcc/gcc/fortran/symbol.c:3575 0x562279 gfc_check_interfaces(gfc_namespace*) ../../gcc/gcc/fortran/interface.c:1691 0x5b3bbb resolve_types ../../gcc/gcc/fortran/resolve.c:14915 0x5a7773 gfc_resolve ../../gcc/gcc/fortran/resolve.c:14999 0x5a7773 gfc_resolve(gfc_namespace*) ../../gcc/gcc/fortran/resolve.c:14987 0x59d287 gfc_parse_file() ../../gcc/gcc/fortran/parse.c:4602 0x5da8d5 gfc_be_parse_file ../../gcc/gcc/fortran/f95-lang.c:189 Please submit a full bug report,
Appears to work fine with 4.6.3, goes wrong with 4.7.2
Some debugging seems to indicate that it is due to the implementation of the constructor, i.e. DT name == generic name. The problem is that for iface->sym "sym" contains undefined memory (presumably created and later freed), which fails for iface->sym->name. "iface" is: resolve.c: for (iface = sym->generic; iface; iface = iface->next) and sym->name is "realspace_grid_input_type". Thus, it seems as if the DT has been deleted but not the entry in the generic list.
GCC 4.7.3 is being released, adjusting target milestone.
Still present at revision 200247.
This appeared at r181425.
> This appeared at r181425. This revision also gives pr57129.
Slightly reduced test MODULE realspace_grid_types PUBLIC :: realspace_grid_input_type CONTAINS SUBROUTINE rs_grid_create_descriptor ( ) TYPE(realspace_grid_input_type), END SUBROUTINE END MODULE realspace_grid_types pr56674_red.f90:5.35: TYPE(realspace_grid_input_type), 1 Error: Derived type 'realspace_grid_input_type' at (1) is being used before it is defined f951: internal compiler error: Segmentation fault: 11
The 4.7 branch is being closed, moving target milestone to 4.8.4.
GCC 4.8.4 has been released.
Author: mikael Date: Fri Apr 10 11:29:53 2015 New Revision: 221972 URL: https://gcc.gnu.org/viewcvs?rev=221972&root=gcc&view=rev Log: PR fortran/56674 PR fortran/58813 PR fortran/59016 PR fortran/59024 fortran/ * symbol.c (save_symbol_data, gfc_save_symbol_data): Rename the former to the latter and make it non-static. Update callers. * gfortran.h (gfc_save_symbol_data): New prototype. * decl.c (gfc_match_decl_type_spec): Call 'gfc_save_symbol_data' before modifying symbols 'sym' and 'dt_sym'. testsuite/ * gfortran.dg/used_types_27.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/used_types_27.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/symbol.c trunk/gcc/testsuite/ChangeLog
Author: mikael Date: Tue Apr 14 09:18:15 2015 New Revision: 222078 URL: https://gcc.gnu.org/viewcvs?rev=222078&root=gcc&view=rev Log: PR fortran/56674 PR fortran/58813 PR fortran/59016 PR fortran/59024 fortran/ * symbol.c (save_symbol_data, gfc_save_symbol_data): Rename the former to the latter and make it non-static. Update callers. * gfortran.h (gfc_save_symbol_data): New prototype. * decl.c (gfc_match_decl_type_spec): Call 'gfc_save_symbol_data' before modifying symbols 'sym' and 'dt_sym'. testsuite/ * gfortran.dg/used_types_27.f90: New. Added: branches/gcc-4_9-branch/gcc/testsuite/gfortran.dg/used_types_27.f90 Modified: branches/gcc-4_9-branch/gcc/fortran/ChangeLog branches/gcc-4_9-branch/gcc/fortran/decl.c branches/gcc-4_9-branch/gcc/fortran/gfortran.h branches/gcc-4_9-branch/gcc/fortran/symbol.c branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
Author: mikael Date: Tue Apr 14 12:23:30 2015 New Revision: 222086 URL: https://gcc.gnu.org/viewcvs?rev=222086&root=gcc&view=rev Log: PR fortran/56674 PR fortran/58813 PR fortran/59016 PR fortran/59024 fortran/ * symbol.c (save_symbol_data, gfc_save_symbol_data): Rename the former to the latter and make it non-static. Update callers. * gfortran.h (gfc_save_symbol_data): New prototype. * decl.c (gfc_match_decl_type_spec): Call 'gfc_save_symbol_data' before modifying symbols 'sym' and 'dt_sym'. testsuite/ * gfortran.dg/used_types_27.f90: New. Added: branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/used_types_27.f90 Modified: branches/gcc-4_8-branch/gcc/fortran/ChangeLog branches/gcc-4_8-branch/gcc/fortran/decl.c branches/gcc-4_8-branch/gcc/fortran/gfortran.h branches/gcc-4_8-branch/gcc/fortran/symbol.c branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
Dup. *** This bug has been marked as a duplicate of bug 59016 ***