Hi,
this patch fixes ICE in is_a test when cgraph_update_edges_for_call_stmt_node
tries to convert non-call stmt to call.  I have bootstrapped/regtested
x86_64-linux and tested firefox/chromium LTO build, so hope it is the last
issue surfacing from the today verifier change.

        PR middle-end/65595
        * cgraph.c (cgraph_update_edges_for_call_stmt_node): Only
        do redirection if the call is not optimized out.

        * gcc.c-torture/compile/pr65595.c: New testcase.
Index: cgraph.c
===================================================================
--- cgraph.c    (revision 221707)
+++ cgraph.c    (working copy)
@@ -1516,7 +1516,7 @@ cgraph_update_edges_for_call_stmt_node (
       if (e)
        {
          /* Keep calls marked as dead dead.  */
-         if (e->callee
+         if (new_call && e->callee
              && DECL_BUILT_IN_CLASS (e->callee->decl) == BUILT_IN_NORMAL
              && DECL_FUNCTION_CODE (e->callee->decl) == BUILT_IN_UNREACHABLE)
            {
Index: testsuite/gcc.c-torture/compile/pr65595.c
===================================================================
--- testsuite/gcc.c-torture/compile/pr65595.c   (revision 0)
+++ testsuite/gcc.c-torture/compile/pr65595.c   (revision 0)
@@ -0,0 +1,19 @@
+extern void *memcpy(void *, const void *, unsigned long);
+struct in6_addr {
+  struct {
+    int u6_addr32[4];
+  };
+};
+struct foo {
+  struct in6_addr daddr;
+  struct in6_addr saddr;
+} a;
+extern void ip6_route_output(struct foo, int);
+int b;
+static void find_route_ipv6(struct in6_addr *p1) {
+  if (p1)
+    memcpy(0, p1, sizeof(struct in6_addr));
+  ip6_route_output(a, b);
+}
+void cxgbi_ep_connect() { find_route_ipv6(0); }
+

Reply via email to