This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: [PATCH] fortran/67758 -- Prevent ICE caused by misplaced COMMON


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.

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.

Mikael


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]