Message ID | 560E4E26.6000302@sfr.fr |
---|---|
State | New |
Headers | show |
On Fri, Oct 02, 2015 at 11:28:06AM +0200, Mikael Morin wrote: > Le 01/10/2015 18:30, Steve Kargl a écrit : > > I'm fine with your patch, although I find the error message > > to be somewhat confusing as no procedure appears in COMMON. > > Well, XX is implicitly a procedure. > Yes, I understamf what gfortran is doing. However, I less fluent Fortran programmer who expects XX to be an array may be confused by error message. > > The call-stmt in the code is the start of an execution-construct. > > A common-stmt is not allowed in an execution-construct. At > > least, that's how I intepret the BNF in 2.1 of F2008. > > > The error message appears too soon, before we finish parsing the common > statement. If it's delayed, as with the following additional patch, the > common statements is properly rejected: > > common_24.f:10:72: > > COMMON /FMCOM / XX(80 000 000) ! { dg-error "conflicts with > COMMON" } > 1 > Error: Unexpected COMMON statement at (1) > common_24.f:8:72: > > Error: PROCEDURE attribute conflicts with COMMON attribute in ???xx??? at (1) > > This needs a little more polishing (location missing in the second error > message), then let's see how the testsuite likes it. > While I prefer the first error message above, if it requires too much polish, then at least commit your first patch to cure the ICE. We can worry about polish later.
Index: match.c =================================================================== --- match.c (révision 228170) +++ match.c (copie de travail) @@ -4376,9 +4376,6 @@ gfc_match_common (void) goto cleanup; } - if (!gfc_add_in_common (&sym->attr, sym->name, NULL)) - goto cleanup; - if (tail != NULL) tail->common_next = sym; else Index: resolve.c =================================================================== --- resolve.c (révision 228170) +++ resolve.c (copie de travail) @@ -918,6 +918,9 @@ resolve_common_vars (gfc_symbol *sym, bool named_c for (; csym; csym = csym->common_next) { + if (!gfc_add_in_common (&csym->attr, csym->name, NULL)) + continue; + if (csym->value || csym->attr.data) { if (!csym->ns->is_block_data)