[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

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 8 13:07:00 GMT 2011


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?



More information about the Gcc-bugs mailing list