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.
From-SVN: r214351
+2014-08-22 Steven Bosscher <steven@gcc.gnu.org>
+
+ PR fortran/62135
+ * resolve.c (resolve_select): Fix list traversal in case the
+ last element of the CASE list was dropped as unreachable code.
+
2014-08-22 Joost VandeVondele <Joost.VandeVondele@mat.ethz.ch>
PR fortran/61234
/* 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)
{
+2014-08-22 Steven Bosscher <steven@gcc.gnu.org>
+
+ PR fortran/62135
+ * gfortran.dg/pr62135.f90: New test.
+
2014-08-22 Manuel López-Ibáñez <manu@gcc.gnu.org>
* g++.dg/warn/wdate-time.C: Remove.
--- /dev/null
+! { dg-do compile }
+! { dg-options -Wsurprising }
+
+ PROGRAM PR62135
+ IMPLICIT NONE
+ CHARACTER*1 :: choice
+ choice = 'x'
+ SELECT CASE (choice)
+ ! This triggered an ICE: an unreachable case clause
+ ! as the last of a list.
+ CASE ('2':'7','9':'0') ! { dg-warning "can never be matched" }
+ WRITE(*,*) "barf"
+ CASE DEFAULT
+ CONTINUE
+ END SELECT
+ END PROGRAM PR62135
+