public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/50659] [F03] ICE on invalid with procedure interface
Date: Fri, 07 Oct 2011 20:37:00 -0000	[thread overview]
Message-ID: <bug-50659-4-nRcFjTj5dz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-50659-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50659

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011-10-07
     Ever Confirmed|0                           |1

--- Comment #4 from janus at gcc dot gnu.org 2011-10-07 20:36:34 UTC ---
I'm still not completely sure if the test case is valid or not. I could not
find anything in the standard which forbids it, so I'm assuming it is valid for
now.

In any case, here is a draft patch which fixes the ICE:

Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c    (revision 179659)
+++ gcc/fortran/expr.c    (working copy)
@@ -4146,15 +4147,14 @@ replace_symbol (gfc_expr *expr, gfc_symbol *sym, i
        && !gfc_is_intrinsic (expr->symtree->n.sym, 0, expr->where)))
       && expr->symtree->n.sym->ns == sym->ts.interface->formal_ns)
     {
-      gfc_symtree *stree;
-      gfc_namespace *ns = sym->formal_ns;
-      /* Don't use gfc_get_symtree as we prefer to fail badly if we don't find
-     the symtree rather than create a new one (and probably fail later).  */
-      stree = gfc_find_symtree (ns ? ns->sym_root : gfc_current_ns->sym_root,
-                      expr->symtree->n.sym->name);
-      gcc_assert (stree);
-      stree->n.sym->attr = expr->symtree->n.sym->attr;
-      expr->symtree = stree;
+      gfc_symtree *root = sym->formal_ns ? sym->formal_ns->sym_root
+                     : gfc_current_ns->sym_root;
+      gfc_symtree *stree = gfc_find_symtree (root,
expr->symtree->n.sym->name);
+      if (stree)
+    {
+      stree->n.sym->attr = expr->symtree->n.sym->attr;
+      expr->symtree = stree;
+    }
     }
   return false;
 }


  parent reply	other threads:[~2011-10-07 20:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-07 17:20 [Bug fortran/50659] New: " abenson at caltech dot edu
2011-10-07 18:23 ` [Bug fortran/50659] [F03] " janus at gcc dot gnu.org
2011-10-07 18:46 ` janus at gcc dot gnu.org
2011-10-07 19:33 ` janus at gcc dot gnu.org
2011-10-07 20:37 ` janus at gcc dot gnu.org [this message]
2011-10-07 20:43 ` [Bug fortran/50659] [4.5/4.6/4.7 Regression] " janus at gcc dot gnu.org
2011-10-07 23:06 ` janus at gcc dot gnu.org
2011-10-08 10:49 ` [Bug fortran/50659] [4.5/4.6/4.7 Regression] [F03] ICE with PROCEDURE statement janus at gcc dot gnu.org
2011-10-08 10:55 ` dominiq at lps dot ens.fr
2011-10-08 11:12 ` [Bug fortran/50659] [4.4/4.5/4.6/4.7 " janus at gcc dot gnu.org
2011-10-08 11:20 ` janus at gcc dot gnu.org
2011-10-08 15:09 ` janus at gcc dot gnu.org
2011-10-09 11:34 ` janus at gcc dot gnu.org
2011-10-10 11:31 ` rguenth at gcc dot gnu.org
2011-10-12 18:54 ` janus at gcc dot gnu.org
2011-10-13 15:04 ` janus at gcc dot gnu.org
2011-10-15 12:16 ` janus at gcc dot gnu.org
2011-10-15 12:18 ` janus at gcc dot gnu.org
2011-10-20 12:37 ` dodji at gcc dot gnu.org

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=bug-50659-4-nRcFjTj5dz@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).