re PR fortran/33152 (Initialization/declaration problems in block data)

2007-11-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/33152
	* decl.c (add_init_expr_to_sym): Remove error message.
	* resolve.c (check_data_variable): Add new check for a data variable
	that has an array spec, but no ref and issue an error.
	* match.c (gfc_match_common): Remove error message.

From-SVN: r130415
This commit is contained in:
Jerry DeLisle 2007-11-25 22:12:19 +00:00
parent bfd61955ce
commit f1607c0199
4 changed files with 15 additions and 24 deletions

View File

@ -1,3 +1,11 @@
2007-11-25 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/33152
* decl.c (add_init_expr_to_sym): Remove error message.
* resolve.c (check_data_variable): Add new check for a data variable
that has an array spec, but no ref and issue an error.
* match.c (gfc_match_common): Remove error message.
2007-11-25 Tobias Burnus <burnus@net-b.de>
PR fortran/34079

View File

@ -1176,15 +1176,6 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
return FAILURE;
}
if (attr.in_common
&& !attr.data
&& *initp != NULL)
{
gfc_error ("Initializer not allowed for COMMON variable '%s' at %C",
sym->name);
return FAILURE;
}
if (init == NULL)
{
/* An initializer is required for PARAMETER declarations. */

View File

@ -2783,21 +2783,6 @@ gfc_match_common (void)
goto cleanup;
}
if (gfc_add_in_common (&sym->attr, sym->name, NULL) == FAILURE)
goto cleanup;
if (sym->value != NULL && sym->value->expr_type != EXPR_NULL
&& (name[0] == '\0' || !sym->attr.data))
{
if (name[0] == '\0')
gfc_error ("Previously initialized symbol '%s' in "
"blank COMMON block at %C", sym->name);
else
gfc_error ("Previously initialized symbol '%s' in "
"COMMON block '%s' at %C", sym->name, name);
goto cleanup;
}
if (gfc_add_in_common (&sym->attr, sym->name, NULL) == FAILURE)
goto cleanup;

View File

@ -8010,6 +8010,13 @@ check_data_variable (gfc_data_variable *var, locus *where)
e->symtree->n.sym->name, &e->symtree->n.sym->declared_at);
}
if (e->ref == NULL && e->symtree->n.sym->as)
{
gfc_error ("DATA array '%s' at %L must be specified in a previous"
" declaration", e->symtree->n.sym->name, where);
return FAILURE;
}
if (e->rank == 0)
{
mpz_init_set_ui (size, 1);