re PR fortran/27457 (ICE in match_case_eos())
authorTobias Schlüter <tobi@gcc.gnu.org>
Sun, 7 May 2006 13:46:02 +0000 (15:46 +0200)
committerTobias Schlüter <tobi@gcc.gnu.org>
Sun, 7 May 2006 13:46:02 +0000 (15:46 +0200)
fortran/
PR fortran/27457
* match.c (match_case_eos): Error out on garbage following
CASE(...).
testsuite/
PR fortran/27457
* gfortran.dg/select_6.f90: New.

From-SVN: r113602

gcc/fortran/ChangeLog
gcc/fortran/match.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/select_6.f90 [new file with mode: 0644]

index cd09edaf69615bf52f6986ca9f710ed34205b4b7..e76b07ed10bc7cee6de8940e097cd9f1cb87693f 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-07  Tobias Schl\81üter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/27457
+       * match.c (match_case_eos): Error out on garbage following
+       CASE(...).
+
 2006-05-07  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/24813
index 865781f9f865f5ad75dfb6ccdb3bf4462740a89e..81bbb233815f4a45aeb7555868b5b1f4b69695d3 100644 (file)
@@ -3024,6 +3024,11 @@ match_case_eos (void)
   if (gfc_match_eos () == MATCH_YES)
     return MATCH_YES;
 
+  /* If the case construct doesn't have a case-construct-name, we
+     should have matched the EOS.  */
+  if (!gfc_current_block ())
+    return MATCH_ERROR;
+
   gfc_gobble_whitespace ();
 
   m = gfc_match_name (name);
index 7ddd103f14c8d0cf2451c3f618eb6f432426be71..5ac84b03a21c0de4166f714c9bff85d3477386e3 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-07  Tobias Schlüter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/27457
+       * gfortran.dg/select_6.f90: New.
+
 2006-05-07  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/27136
diff --git a/gcc/testsuite/gfortran.dg/select_6.f90 b/gcc/testsuite/gfortran.dg/select_6.f90
new file mode 100644 (file)
index 0000000..2d995b0
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! PR fortran/27457
+! This lead to a segfault previously.
+        implicit none
+        integer(kind=1) :: i
+        real :: r(3)
+        select case (i)
+        case (129) r(4) = 0 { dg-error "Unclassifiable" }
+        end select
+        end