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 tree-optimization/51012] [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr
Date: Tue, 08 Nov 2011 13:07:00 -0000	[thread overview]
Message-ID: <bug-51012-4-NmxuUuuf86@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51012-4@http.gcc.gnu.org/bugzilla/>

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |jamborm at gcc dot gnu.org

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-08 12:55:53 UTC ---
With -fno-ipa-cp it is indirect inlining that performs the bogus inline.
Fixed (for non-WPA only?) by

Index: gcc/ipa-prop.c
===================================================================
--- gcc/ipa-prop.c      (revision 181154)
+++ gcc/ipa-prop.c      (working copy)
@@ -1905,6 +1905,13 @@ update_indirect_edges_after_inlining (st
       if (new_direct_edge)
        {
          new_direct_edge->indirect_inlining_edge = 1;
+         if (new_direct_edge->call_stmt
+             && !gimple_check_call_matching_types (new_direct_edge->call_stmt,
+                                                  
new_direct_edge->callee->decl))
+           {
+             gimple_call_set_cannot_inline (new_direct_edge->call_stmt, true);
+             new_direct_edge->call_stmt_cannot_inline_p = true;
+           }
          if (new_edges)
            {
              VEC_safe_push (cgraph_edge_p, heap, *new_edges,

With -fipa-cp not disabled we still ICE, but we can fixup in
cgraph_make_edge_direct (how many copies of such code remain?)

Index: gcc/cgraph.c
===================================================================
--- gcc/cgraph.c        (revision 181154)
+++ gcc/cgraph.c        (working copy)
@@ -1184,6 +1184,13 @@ cgraph_make_edge_direct (struct cgraph_e
   /* Insert to callers list of the new callee.  */
   cgraph_set_edge_callee (edge, callee);

+  if (edge->call_stmt
+      && !gimple_check_call_matching_types (edge->call_stmt, callee->decl))
+    {
+      gimple_call_set_cannot_inline (edge->call_stmt, true);
+      edge->call_stmt_cannot_inline_p = true;
+    }
+
   /* We need to re-determine the inlining status of the edge.  */
   initialize_inline_failed (edge);
 }

What about WPA stage?  I think we don't "fixup" inlinable status of
edges at the beginning of ltrans (or inline transform).  Do we?


  parent reply	other threads:[~2011-11-08 12:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07 19:50 [Bug tree-optimization/51012] New: " zsojka at seznam dot cz
2011-11-08 10:37 ` [Bug tree-optimization/51012] " rguenth at gcc dot gnu.org
2011-11-08 13:07 ` rguenth at gcc dot gnu.org [this message]
2011-11-08 13:25 ` jamborm at gcc dot gnu.org
2011-11-08 14:18 ` rguenther at suse dot de
2011-11-08 15:19 ` rguenth at gcc dot gnu.org
2011-11-08 15:44 ` rguenth 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-51012-4-NmxuUuuf86@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).