public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikael Morin <mikael.morin@sfr.fr>
To: Steve Kargl <sgk@troutmask.apl.washington.edu>
Cc: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] fortran/67758 -- Prevent ICE caused by misplaced COMMON
Date: Fri, 02 Oct 2015 09:28:00 -0000	[thread overview]
Message-ID: <560E4E26.6000302@sfr.fr> (raw)
In-Reply-To: <20151001163040.GA77294@troutmask.apl.washington.edu>

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)

  reply	other threads:[~2015-10-02  9:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01  0:06 Steve Kargl
2015-10-01  0:07 ` Steve Kargl
2015-10-01 12:16   ` Mikael Morin
2015-10-01 13:29     ` Mikael Morin
2015-10-01 16:30       ` Steve Kargl
2015-10-02  9:28         ` Mikael Morin [this message]
2015-10-02 16:44           ` Steve Kargl
2015-10-03 10:13             ` Mikael Morin
2015-10-03 19:09               ` Steve Kargl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=560E4E26.6000302@sfr.fr \
    --to=mikael.morin@sfr.fr \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=sgk@troutmask.apl.washington.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).