The following invalid testcase causes an ICE when compiled with -Wall: =============== else =============== The error message is: In file bug.f90:1 else 1 Error: Unexpected ELSE statement at (1) bug.f90:0: internal compiler error: Segmentation fault Without -Wall I get: In file bug.f90:1 else 1 Error: Unexpected ELSE statement at (1) Error: Unexpected end of file in 'bug.f90' This happens since GCC 4.0.1.
Index: parse.c =================================================================== --- parse.c (revision 113473) +++ parse.c (working copy) @@ -624,6 +624,7 @@ next_statement (void) if (gfc_at_eol ()) { if (gfc_option.warn_line_truncation + && gfc_current_locus.lb && gfc_current_locus.lb->truncated) gfc_warning_now ("Line truncated at %C");
(In reply to comment #1) > Index: parse.c > =================================================================== > --- parse.c (revision 113473) > +++ parse.c (working copy) > @@ -624,6 +624,7 @@ next_statement (void) > if (gfc_at_eol ()) > { > if (gfc_option.warn_line_truncation > + && gfc_current_locus.lb > && gfc_current_locus.lb->truncated) > gfc_warning_now ("Line truncated at %C"); > Looks like an "Obviously correct" patch.
Subject: Bug 27378 Author: fxcoudert Date: Sun May 7 16:33:30 2006 New Revision: 113603 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113603 Log: PR fortran/27378 * parse.c (next_statement): Add check to avoid an ICE when gfc_current_locus.lb is not set. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/parse.c
> Looks like an "Obviously correct" patch. Commited the "Obviously correct" patch after regtesting on i686-linux.
Subject: Bug 27378 Author: fxcoudert Date: Mon May 8 10:43:18 2006 New Revision: 113629 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113629 Log: PR fortran/27378 * parse.c (next_statement): Add check to avoid an ICE when gfc_current_locus.lb is not set. Modified: branches/gcc-4_1-branch/gcc/fortran/ChangeLog branches/gcc-4_1-branch/gcc/fortran/parse.c
Fixed on 4.1 and mainline.