https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109231

--- Comment #23 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Ugh, that sounds like an uninitialized use of something somewhere,
unfortunately if it is really my commit, I don't understand how it could cause
it.
All it changes is that when tree_versioning is called, the push_struct_function
-> allocate_struct_function will not do the
      if (!abstract_p)
        {
          /* Now that we have activated any function-specific attributes
             that might affect layout, particularly vector modes, relayout
             each of the parameters and the result.  */
          relayout_decl (result);
          for (tree parm = DECL_ARGUMENTS (fndecl); parm;
               parm = DECL_CHAIN (parm))
            relayout_decl (parm);
        }
and
      if (!abstract_p && aggregate_value_p (result, fndecl))
        {
#ifdef PCC_STATIC_STRUCT_RETURN
          cfun->returns_pcc_struct = 1;
#endif
          cfun->returns_struct = 1;
        }
parts it did before when abstract_p was false in this case.
As I wrote, initialize_cfun has
  cfun->returns_struct = src_cfun->returns_struct;
  cfun->returns_pcc_struct = src_cfun->returns_pcc_struct;
a few lines later, so whatever it sets cfun->returns* to should be overritten
quickly.
It is true allocate_stack_function calls before that allocate_stack_usage_info
and
stdarg_p but neither of those two should care about those flag or whatever
relayout_decl does.
Perhaps try to undo my patch in a different way, like
--- gcc/tree-inline.cc  2023-03-17 18:59:50.226199917 +0100
+++ gcc/tree-inline.cc  2023-03-29 12:47:21.546947442 +0200
@@ -2785,7 +2785,7 @@ initialize_cfun (tree new_fndecl, tree c
   gimple_register_cfg_hooks ();

   /* Get clean struct function.  */
-  push_struct_function (new_fndecl, true);
+  push_struct_function (new_fndecl, false);
   targetm.target_option.relayout_function (new_fndecl);

   /* We will rebuild these, so just sanity check that they are empty.  */
or
--- gcc/tree-inline.cc  2023-03-17 18:59:50.226199917 +0100
+++ gcc/tree-inline.cc  2023-03-29 12:49:16.580255668 +0200
@@ -2786,7 +2786,11 @@ initialize_cfun (tree new_fndecl, tree c

   /* Get clean struct function.  */
   push_struct_function (new_fndecl, true);
+  relayout_decl (DECL_RESULT (new_fndecl));
+  for (tree parm = DECL_ARGUMENTS (new_fndecl); parm; parm = DECL_CHAIN
(parm))
+    relayout_decl (parm);
   targetm.target_option.relayout_function (new_fndecl);
+  aggregate_value_p (DECL_RESULT (new_fndecl), new_fndecl);

   /* We will rebuild these, so just sanity check that they are empty.  */
   gcc_assert (VALUE_HISTOGRAMS (cfun) == NULL);
and see if that changes anything?  Of course both of those patches break the
PR105554
again.  Or if the latter helps, try to comment out the different parts of it
too.

Seems there was some valgrind for SPARC Solaris out of tree, but can't find it
anymore...

Reply via email to