From: Thomas Koenig Date: Tue, 26 Apr 2011 22:07:11 +0000 (+0000) Subject: decl.c (gfc_match_end): Check that the block name starts with "block@". X-Git-Tag: upstream/12.2.0~84774 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a1fd30c8a3a4474ff04b9d857deff3792fa2087;p=platform%2Fupstream%2Fgcc.git decl.c (gfc_match_end): Check that the block name starts with "block@". 2011-04-26 Thomas Koenig * 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 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f9425a9..78d687d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,12 @@ 2011-04-26 Thomas Koenig + * 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 + * frontend-passes.c (inserted_block): New variable. (changed_statement): Likewise. (create_var): Encase statement to be operated on in a BLOCK. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 9efe01a..9901fb1 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -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; diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 5d2237a..ff029bf 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -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);