decl.c (gfc_match_end): Check that the block name starts with "block@".
authorThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 26 Apr 2011 22:07:11 +0000 (22:07 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 26 Apr 2011 22:07:11 +0000 (22:07 +0000)
2011-04-26  Thomas Koenig  <tkoenig@gcc.gnu.org>

* decl.c (gfc_match_end):  Check that the block name starts
with "block@".
* parse.c (gfc_build_block_ns):  Make block names unique by
numbering them.

From-SVN: r172990

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/fortran/parse.c

index f9425a9e16a6c3760acb25a57fe8421227487c6d..78d687dbeedba2bae88fb4934b5cfdfa6856f94a 100644 (file)
@@ -1,3 +1,10 @@
+2011-04-26  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       * decl.c (gfc_match_end):  Check that the block name starts
+       with "block@".
+       * parse.c (gfc_build_block_ns):  Make block names unique by
+       numbering them.
+
 2011-04-26  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        * frontend-passes.c (inserted_block):  New variable.
index 9efe01aac2c1c084b3b6fe172339b5948b1dfdfc..9901fb16a73a08b3d4aad5d842aca15205b53e77 100644 (file)
@@ -5746,7 +5746,7 @@ gfc_match_end (gfc_statement *st)
     {
     case COMP_ASSOCIATE:
     case COMP_BLOCK:
-      if (!strcmp (block_name, "block@"))
+      if (!strncmp (block_name, "block@", strlen("block@")))
        block_name = NULL;
       break;
 
index 5d2237a108956cb4539346d0829ba7c50e49b0b9..ff029bf18f76ecd7259c9e75c13653d2d83e6c34 100644 (file)
@@ -3135,6 +3135,7 @@ gfc_namespace*
 gfc_build_block_ns (gfc_namespace *parent_ns)
 {
   gfc_namespace* my_ns;
+  static int numblock = 1;
 
   my_ns = gfc_get_namespace (parent_ns, 1);
   my_ns->construct_entities = 1;
@@ -3149,8 +3150,10 @@ gfc_build_block_ns (gfc_namespace *parent_ns)
   else
     {
       gfc_try t;
+      char buffer[20];  /* Enough to hold "block@2147483648\n".  */
 
-      gfc_get_symbol ("block@", my_ns, &my_ns->proc_name);
+      snprintf(buffer, sizeof(buffer), "block@%d", numblock++);
+      gfc_get_symbol (buffer, my_ns, &my_ns->proc_name);
       t = gfc_add_flavor (&my_ns->proc_name->attr, FL_LABEL,
                          my_ns->proc_name->name, NULL);
       gcc_assert (t == SUCCESS);