Hi, the IMPORT statement of Fortran2003 is not yet implemented. Trying to use it provokes an ICE: module gfcbug29_import integer, parameter :: dp = kind (1d0) interface subroutine foo (x) import :: dp real (kind=dp) :: x end subroutine foo end interface end module gfcbug29_import % gfortran -c -std=f2003 gfcbug29.f90 In file gfcbug29.f90:6 import :: dp 1 Error: Unclassifiable statement at (1) gfcbug29.f90:0: internal compiler error: Segmentation fault See the Fortran2003 draft, tables 2.1, 2.2, and section 12.3.2.1 about interface blocks. Cheers, -ha
Confirmed.
I'm marking this ice-on-invalid-code, as it is not valid Fortran 95 and the bug is unrelated to the use of IMPORT, the following ICEs the same way: module gfcbug29_import interface subroutine foo (x) something :: dp real (kind=dp) :: x end subroutine foo end interface end module gfcbug29_import
This is weird as I cannot reproduce it on powerpc-darwin but can on x86_64-linux-gnu.
I can reproduce this ICE with mainline on i686-linux. I propose the following patch: Index: parse.c =================================================================== --- parse.c (revision 113603) +++ parse.c (working copy) @@ -1292,7 +1292,7 @@ static void reject_statement (void) { - + gfc_new_block = NULL; gfc_undo_symbols (); gfc_clear_warning (); undo_new_statement (); (see http://gcc.gnu.org/ml/fortran/2006-05/msg00122.html for details).
*** Bug 27487 has been marked as a duplicate of this bug. ***
Subject: Bug 24549 Author: fxcoudert Date: Wed May 10 14:51:26 2006 New Revision: 113671 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113671 Log: PR fortran/24549 * parse.c (reject_statement): Clear gfc_new_block. * gfortran.dg/error_recovery_1.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/error_recovery_1.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/parse.c trunk/gcc/testsuite/ChangeLog
(In reply to comment #5) > *** Bug 27487 has been marked as a duplicate of this bug. *** Well, first of all I have to admit that I am only a Fortran user. But PR 27487 is only a duplicate because Tobias changed the subject of my original entry, which was a request for the implementation of F2003 IMPORT. FX: Fixing gfortran's error recovery is not the answer to this PR, but to the other one. For this reason it seems more reasonable to change the status of PR 27487 back and move your patch there. Next, the subject of this PR should be reset to my original one, as IMPORT is required for F2003 support, see PR 20585.
(In reply to comment #7) > FX: Fixing gfortran's error recovery is not the answer to this PR, > but to the other one. Yes, I know. Since this PR was already used for tracking the ICE, I planned on opening a new PR for the F2003 IMPORT feature when this one was resolved. It is now filed as PR 27546 (and you're in the CC list).
Subject: Bug 24549 Author: fxcoudert Date: Thu May 11 21:39:06 2006 New Revision: 113713 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113713 Log: PR fortran/20460 PR fortran/24549 * parse.c (reject_statement): Clear gfc_new_block. * resolve.c (gfc_resolve_index): Make REAL array indices a GFC_STD_LEGACY feature. * gfortran.dg/error_recovery_1.f90: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/error_recovery_1.f90 - copied unchanged from r113671, trunk/gcc/testsuite/gfortran.dg/error_recovery_1.f90 Modified: branches/gcc-4_1-branch/gcc/fortran/ChangeLog branches/gcc-4_1-branch/gcc/fortran/parse.c branches/gcc-4_1-branch/gcc/fortran/resolve.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
Fixed on mainline and 4.1.