public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/55935] [OOP] Fortran fronted has ADDR_EXPRs of FUNCTION_DECLs with bogus BLOCK
Date: Fri, 11 Jan 2013 13:44:00 -0000	[thread overview]
Message-ID: <bug-55935-4-hhcXZeQwnY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-55935-4@http.gcc.gnu.org/bugzilla/>


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

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-11 13:43:50 UTC ---
(In reply to comment #7)
> Created attachment 29142 [details]
> gcc48-pr55935.patch
> 
> Untested fix.  Although the FE perhaps could unshare_expr_without_location so
> that ADDR_EXPRs in the ctor don't have location, IMHO gimple-fold.c still has
> to at least unshare_expr those expressions it copies from the constructors,
> otherwise we'll end up with invalid sharing of ADDR_EXPRs etc. between
> different functions (or within the same function).
> 
> This can be reproduced even with C:
> void foo (void);
> struct S { int i; void (*fn) (); };
> const struct S s = { 5, foo };
> void *fn1 (int x) { if (x < 0) return s.fn; if (x) return 0; return s.fn; }
> void *fn2 (int x) { if (x < 0) return s.fn; if (x) return 0; return s.fn; }
> void *fn3 (void) { return s.fn; }
> void *fn4 (void) { return s.fn; }
> at -O2, in *.copyrename1 pass all 6 ADDR_EXPRs in the IL are still shared.
> ccp1 for whatever reason unshares them all (surprisingly).

We allow those to pass verification in verify_node_sharing because:

/* Return true when the T can be shared.  */

bool
tree_node_can_be_shared (tree t)
{
  if (IS_TYPE_OR_DECL_P (t)
      || TREE_CODE (t) == SSA_NAME
      || is_gimple_min_invariant (t)
      || t == error_mark_node
      || TREE_CODE (t) == IDENTIFIER_NODE)
    return true;

is_gimple_min_invariant is bogus here IMHO.  But I guess "fixing" that
might have quite some fallout ...

Btw, get_symbol_constant_value also unshares the result from
canonicalize_constructor_val (if it's is_gimple_min_invariant).

I suppose we should try fixing tree_node_can_be_shared ...


  parent reply	other threads:[~2013-01-11 13:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-10 15:37 [Bug fortran/55935] New: " burnus at gcc dot gnu.org
2013-01-10 16:01 ` [Bug fortran/55935] " dominiq at lps dot ens.fr
2013-01-10 16:25 ` dominiq at lps dot ens.fr
2013-01-10 16:29 ` jakub at gcc dot gnu.org
2013-01-10 17:35 ` dominiq at lps dot ens.fr
2013-01-10 22:35 ` dominiq at lps dot ens.fr
2013-01-10 23:11 ` dominiq at lps dot ens.fr
2013-01-11  9:19 ` jakub at gcc dot gnu.org
2013-01-11 10:03 ` jakub at gcc dot gnu.org
2013-01-11 13:36 ` dominiq at lps dot ens.fr
2013-01-11 13:44 ` rguenth at gcc dot gnu.org [this message]
2013-01-11 14:06 ` rguenth at gcc dot gnu.org
2013-01-11 14:31 ` rguenth at gcc dot gnu.org
2013-01-11 14:41 ` jakub at gcc dot gnu.org
2013-01-11 14:54 ` rguenth at gcc dot gnu.org
2013-01-11 14:56 ` rguenth at gcc dot gnu.org
2013-01-13 12:34 ` jakub at gcc dot gnu.org
2013-01-13 16:54 ` jakub 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-55935-4-hhcXZeQwnY@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).