This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/29537] ICE in gfc_match_common for blank common in BLOCK DATA unit
- From: "aldot at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Oct 2006 11:50:45 -0000
- Subject: [Bug fortran/29537] ICE in gfc_match_common for blank common in BLOCK DATA unit
- References: <bug-29537-11811@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from aldot at gcc dot gnu dot org 2006-10-22 11:50 -------
> I think the code in comment #1 is valid.
Rejecting blank common in block data stmts would add a regression in
testsuite's blockdata_1.f90 like so:
me@s37:~/src/gcc-4.2/gcc/testsuite/gfortran.dg$ gfortran-4.2-HEAD -S -o foo.s
-W -Wall blockdata_1.f90
In file blockdata_1.f90:17
common j
1
Error: BLOCK DATA unit cannot contain blank COMMON at (1)
In file blockdata_1.f90:18
data j /1/
1
Error: BLOCK DATA element 'j' at (1) must be in COMMON
So rejecting the blank common must be wrong, fwiw :)
--- match.c (revision 117934)
+++ match.c (working copy)
@@ -2327,16 +2328,20 @@ gfc_match_common (void)
if (name[0] == '\0')
{
+ if (gfc_current_ns->is_block_data)
+ {
+ gfc_error ("BLOCK DATA unit cannot contain blank COMMON at %C");
+ goto cleanup;
+ }
t = &gfc_current_ns->blank_common;
if (t->head == NULL)
t->where = gfc_current_locus;
- head = &t->head;
}
else
{
t = gfc_get_common (name, 0);
- head = &t->head;
}
+ head = &t->head;
if (*head == NULL)
tail = NULL;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29537