This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Tobias Burnus wrote:Jerry DeLisle wrote:This patch adds back a simplified error message and checks to see if the symbol is in BLOCK DATA or not. Allowed if -std=gnu. Regression tested on x86-64. OK for trunk?
+ if (gfc_add_in_common (&sym->attr, sym->name, NULL) == FAILURE) + goto cleanup;
[...]
+
if (gfc_add_in_common (&sym->attr, sym->name, NULL) == FAILURE)
goto cleanup;
The double statement above was there before. I thought it was odd also, but put it back the way it was before. I will take it out and test.
Adding in_common twice looks wrong.I will have a look later this evening.
Additionally, the following variant using DATA compiles without giving an error:
program main implicit none integer, parameter:: nmin = 2 character(len=3) :: emname(nmin) data emname/'bar','baz'/ common/dd/emname ! { dg-error "can only be COMMON in BLOCK DATA" } end program main
Index: match.c
===================================================================
--- match.c (revision 130417)
+++ match.c (working copy)
@@ -2783,6 +2783,16 @@ gfc_match_common (void)
goto cleanup;
}
+ if (((sym->value != NULL && sym->value->expr_type != EXPR_NULL)
+ || sym->attr.data) && gfc_current_state () != COMP_BLOCK_DATA)
+ {
+ if (gfc_notify_std (GFC_STD_GNU, "Initialized symbol '%s' at %C "
+ "can only be COMMON in "
+ "BLOCK DATA", sym->name)
+ == FAILURE)
+ goto cleanup;
+ }
+
if (gfc_add_in_common (&sym->attr, sym->name, NULL) == FAILURE)
goto cleanup;
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |