The following properly sets DECL_CONTEXT of the result decl we build,
otherwise LTO happily merges those across different resolver decls
ending up in IPA PTA ICEing on this invalidity.

Bootstrap & regtest running on x86_64-unknown-linux-gnu, will apply
as obvious.

Wonder if other targets copied from this, ah, powerpc did,
will commit a powerpc fix alongside (w/o further testing).

Richard.

2019-03-14  Richard Biener  <rguent...@suse.de>

        PR target/89711
        * config/i386/i386.c (make_resolver_func): Properly set
        DECL_CONTEXT on the RESULT_DECL.
        * config/rs6000/rs6000.c (make_resolver_func): Likewise.

Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c      (revision 269678)
+++ gcc/config/i386/i386.c      (working copy)
@@ -32572,6 +32572,7 @@ make_resolver_func (const tree default_d
     }
   /* Build result decl and add to function_decl. */
   t = build_decl (UNKNOWN_LOCATION, RESULT_DECL, NULL_TREE, ptr_type_node);
+  DECL_CONTEXT (t) = decl;
   DECL_ARTIFICIAL (t) = 1;
   DECL_IGNORED_P (t) = 1;
   DECL_RESULT (decl) = t;
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c  (revision 269678)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -37467,6 +37467,7 @@ make_resolver_func (const tree default_d
 
   /* Build result decl and add to function_decl.  */
   tree t = build_decl (UNKNOWN_LOCATION, RESULT_DECL, NULL_TREE, 
ptr_type_node);
+  DECL_CONTEXT (t) = decl;
   DECL_ARTIFICIAL (t) = 1;
   DECL_IGNORED_P (t) = 1;
   DECL_RESULT (decl) = t;

Reply via email to