Commit f172301f by Steven Bosscher

re PR fortran/62135 (ICE with invalid SELECT CASE selector)

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
parent 596e808c
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> 2014-08-22 Joost VandeVondele <Joost.VandeVondele@mat.ethz.ch>
PR fortran/61234 PR fortran/61234
......
...@@ -7761,7 +7761,7 @@ resolve_select (gfc_code *code, bool select_type) ...@@ -7761,7 +7761,7 @@ resolve_select (gfc_code *code, bool select_type)
/* Strip all other unreachable cases. */ /* Strip all other unreachable cases. */
if (body->ext.block.case_list) 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) 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> 2014-08-22 Manuel López-Ibáñez <manu@gcc.gnu.org>
* g++.dg/warn/wdate-time.C: Remove. * g++.dg/warn/wdate-time.C: Remove.
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment