Created attachment 28113 [details] Sample Code $gfortran --version GNU Fortran (GCC) 4.7.2 20120818 (prerelease) Copyright (C) 2012 Free Software Foundation, Inc. $gfortran -C class.f03 -o class f951: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. See attached code.
AFAICT the code is invalid: pr54443.f90:43.25: select type(hp%htype) 1 Error: Selector in SELECT TYPE at (1) is not a named variable; use associate-name=> ... From my archives, it seems to have been fixed on trunk between revisions 187200, 2012-05-05 (Segmentation fault) and 187291, 2012-05-08 (errors) and it has been introduced between revisions 182107, 2011-12-08 (errors) and 183001, 2012-01-27 (Segmentation fault).
Compiling the following reduced test program class_test type hashnode ! character(12) :: name character(4) :: htype end type hashnode class(hashnode), pointer :: hfirst,hcur,hp select type(hp%htype) end program class_test gives an internal compiler error: Segmentation fault with trunk, but the error pr54443_red.f90:8.25: select type(hp%htype) 1 Error: Selector in SELECT TYPE at (1) is not a named variable; use associate-name=> if I uncomment the line character(12) :: name, while it still gives an ICE with 4.7.1. The backtrace for trunk is Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: 13 at address: 0x0000000000000000 gfc_match_select_type () at ../../work/gcc/fortran/match.c:5438 5438 && (strcmp (CLASS_DATA (expr1)->name, "_data") == 0) (gdb) bt #0 gfc_match_select_type () at ../../work/gcc/fortran/match.c:5438 #1 0x0000000100078fea in match_word (subr=<value temporarily unavailable, due to optimizations>, old_locus=0x100ea35e0) at ../../work/gcc/fortran/parse.c:67 #2 0x000000014180f750 in ?? () Previous frame inner to this frame (gdb could not unwind past this frame)
The test case in comment 2 ICEs on 4.7 and trunk, but gives the correct error in 4.6, so it's a regression.
This is apparently a duplicate of PR 54435. The patch given there also fixes the ICE here.
Author: janus Date: Tue Sep 4 08:03:09 2012 New Revision: 190910 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190910 Log: 2012-09-04 Janus Weil <janus@gcc.gnu.org> PR fortran/54435 PR fortran/54443 * match.c (gfc_match_select_type): Make sure to only access CLASS_DATA for BT_CLASS. 2012-09-04 Janus Weil <janus@gcc.gnu.org> PR fortran/54243 PR fortran/54244 * gfortran.dg/select_type_29.f03: New. Added: trunk/gcc/testsuite/gfortran.dg/select_type_29.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/match.c trunk/gcc/testsuite/ChangeLog
Fixed on trunk sofar.
Author: janus Date: Mon Sep 10 12:10:12 2012 New Revision: 191135 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191135 Log: 2012-09-10 Janus Weil <janus@gcc.gnu.org> PR fortran/54435 PR fortran/54443 * match.c (gfc_match_select_type): Make sure to only access CLASS_DATA for BT_CLASS. 2012-09-10 Janus Weil <janus@gcc.gnu.org> PR fortran/54435 PR fortran/54443 * gfortran.dg/select_type_29.f03: New. Added: branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/select_type_29.f03 Modified: branches/gcc-4_7-branch/gcc/fortran/ChangeLog branches/gcc-4_7-branch/gcc/fortran/match.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Fixed on trunk and 4.7. Closing.