]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Workaround ICE in gimple_call_static_chain_flags
authorJan Hubicka <jh@suse.cz>
Thu, 4 Nov 2021 16:07:44 +0000 (17:07 +0100)
committerJan Hubicka <jh@suse.cz>
Thu, 4 Nov 2021 16:10:47 +0000 (17:10 +0100)
gcc/ChangeLog:

2021-11-04  Jan Hubicka  <hubicka@ucw.cz>

PR ipa/103058
* gimple.c (gimple_call_static_chain_flags): Handle case when
nested function does not bind locally.

gcc/gimple.c

index 76768c19c8ece50d9b37da62995ef2039f6ba8ca..7a578f5113e823e45363959d44958e8fe8ec3e25 100644 (file)
@@ -1666,7 +1666,18 @@ gimple_call_static_chain_flags (const gcall *stmt)
          int modref_flags = summary->static_chain_flags;
 
          /* We have possibly optimized out load.  Be conservative here.  */
-         gcc_checking_assert (node->binds_to_current_def_p ());
+         if (!node->binds_to_current_def_p ())
+           {
+             if ((modref_flags & EAF_UNUSED) && !(flags & EAF_UNUSED))
+               {
+                 modref_flags &= ~EAF_UNUSED;
+                 modref_flags |= EAF_NOESCAPE;
+               }
+             if ((modref_flags & EAF_NOREAD) && !(flags & EAF_NOREAD))
+               modref_flags &= ~EAF_NOREAD;
+             if ((modref_flags & EAF_DIRECT) && !(flags & EAF_DIRECT))
+               modref_flags &= ~EAF_DIRECT;
+           }
          if (dbg_cnt (ipa_mod_ref_pta))
            flags |= modref_flags;
        }