[Bug fortran/62135] ICE with invalid SELECT CASE selector
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62135 Steven Bosscher changed: What|Removed |Added Keywords|ice-on-invalid-code |ice-on-valid-code Status|ASSIGNED|RESOLVED CC|steven at gcc dot gnu.org | Resolution|--- |FIXED Assignee|unassigned at gcc dot gnu.org |steven at gcc dot gnu.org Target Milestone|--- |5.0 --- Comment #7 from Steven Bosscher --- gcc.gnu.org/r214351 Not a regression, so no reason to back-port. Thus, FIXED.
[Bug fortran/62135] ICE with invalid SELECT CASE selector
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62135 --- Comment #6 from Steven Bosscher --- Author: steven Date: Fri Aug 22 18:43:50 2014 New Revision: 214351 URL: https://gcc.gnu.org/viewcvs?rev=214351&root=gcc&view=rev Log: fortran/ PR fortran/62135 * resolve.c (resolve_select): Fix list traversal in case the last element of the CASE list was dropped as unreachable code. testsuite/ PR fortran/62135 * gfortran.dg/pr62135.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/pr62135.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog
[Bug fortran/62135] ICE with invalid SELECT CASE selector
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62135 kargl at gcc dot gnu.org changed: What|Removed |Added CC||kargl at gcc dot gnu.org --- Comment #5 from kargl at gcc dot gnu.org --- (In reply to Steven Bosscher from comment #4) > > Problem is a simple list walk error if the unreachable case is the > last in the list. Plugged with the following patch. > You must be bored if you're looking at Fortran bugs again. :-) > Index: resolve.c > === > --- resolve.c (revision 214292) > +++ resolve.c (working copy) > @@ -7761,7 +7761,7 @@ resolve_select (gfc_code *code, bool select_type) > /* Strip all other unreachable cases. */ > if (body->ext.block.case_list) > { > - for (cp = body->ext.block.case_list; cp->next; cp = cp->next) > + for (cp = body->ext.block.case_list; cp && cp->next; cp = > cp->next) > { > if (cp->next->unreachable) > { Looks obvious now. If the ICE is fixed, then please commit.
[Bug fortran/62135] ICE with invalid SELECT CASE selector
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62135 --- Comment #4 from Steven Bosscher --- (In reply to Anastasios Vathis from comment #2) > In any case, there sould be a " SYNTAX ERROR" issued It's not an error, the case can simply never match. If you compile with -Wall you get a warning: $ gfortran t.f90 -Wall t.f90:27.23: CASE ('2':'7','9':'0') 1 Warning: Range specification at (1) can never be matched $ Problem is a simple list walk error if the unreachable case is the last in the list. Plugged with the following patch. Index: resolve.c === --- resolve.c (revision 214292) +++ resolve.c (working copy) @@ -7761,7 +7761,7 @@ resolve_select (gfc_code *code, bool select_type) /* Strip all other unreachable cases. */ if (body->ext.block.case_list) { - for (cp = body->ext.block.case_list; cp->next; cp = cp->next) + for (cp = body->ext.block.case_list; cp && cp->next; cp = cp->next) { if (cp->next->unreachable) {
[Bug fortran/62135] ICE with invalid SELECT CASE selector
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62135 Steven Bosscher changed: What|Removed |Added Status|NEW |ASSIGNED CC||steven at gcc dot gnu.org
[Bug fortran/62135] ICE with invalid SELECT CASE selector
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62135 Tobias Burnus changed: What|Removed |Added Keywords||diagnostic, ||ice-on-invalid-code Status|UNCONFIRMED |NEW Last reconfirmed||2014-08-14 CC||burnus at gcc dot gnu.org Summary|f951: internal compiler |ICE with invalid SELECT |error: Segmentation fault |CASE selector Ever confirmed|0 |1 Known to fail||4.6.3, 5.0 --- Comment #3 from Tobias Burnus --- ICEs in 0x62c9b1 resolve_select ../../gcc/fortran/resolve.c:7764