]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/24640 ([4.1] ice with invalid label)
authorSteven G. Kargl <kargls@comcast.net>
Mon, 2 Jan 2006 22:23:35 +0000 (22:23 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 2 Jan 2006 22:23:35 +0000 (22:23 +0000)
PR fortran/24640
* parse.c (next_free): Check for whitespace after the label.
* match.c (gfc_match_small_literal_int): Initialize cnt variable.

* gfortran.dg/label_2.f90: New test.

From-SVN: r109246

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

index c8c82da86791daf043c2c6762e43167d552487d9..e2f63f6131a323a96bd541e55f6774388f163442 100644 (file)
@@ -1,3 +1,9 @@
+2006-01-02  Steven G. Kargl  <kargls@comcast.net>
+
+       PR fortran/24640
+       * parse.c (next_free): Check for whitespace after the label.
+       * match.c (gfc_match_small_literal_int): Initialize cnt variable.
+
 2006-01-01  Steven G. Kargl  <kargls@comcast.net>
 
        * ChangeLog: Split previous years into ...
index e28127b00b4a68bb183191121e24fb77628a401e..a07de602fbf60d93ad7b7bb11288fa058d5985d3 100644 (file)
@@ -151,6 +151,7 @@ gfc_match_small_literal_int (int *value, int *cnt)
 
   gfc_gobble_whitespace ();
   c = gfc_next_char ();
+  *cnt = 0;
 
   if (!ISDIGIT (c))
     {
index a0da4480b8b9d77d37dda08e403f12b623d8ce20..87f36df23fd2a3367e1cdc3eb0aee61f5834b24b 100644 (file)
@@ -334,6 +334,10 @@ next_free (void)
          do
            c = gfc_next_char ();
          while (ISDIGIT(c));
+
+         if (!gfc_is_whitespace (c))
+           gfc_error_now ("Non-numeric character in statement label at %C");
+
        }
       else
        {
index 10f7c252f9380d385af06c8d704e8cada96a3334..a312fd0c6f8e31992937a5c20e47040de4878435 100644 (file)
@@ -1,3 +1,8 @@
+2006-01-02  Steven G. Kargl  <kargls@comcast.net>
+
+       PR fortran/24640
+       * gfortran.dg/label_2.f90: New test.
+
 2006-01-02  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        * g++.dg/lookup/using12.C: Tighten error marker.
diff --git a/gcc/testsuite/gfortran.dg/label_2.f90 b/gcc/testsuite/gfortran.dg/label_2.f90
new file mode 100644 (file)
index 0000000..7b87f6c
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! PR fortran/24640.  We needed to check that whitespace follows
+! a statement label in free form.
+!
+program pr24640
+
+10: a=10   ! { dg-error "character in statement" }
+
+end program
+