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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so this shows a deeper issue with gimplification which either prematurely
marks decls as DECL_GIMPLE_REG_P in gimplify_bind_expr or variables as
TREE_ADDRESSABLE too late in gimplify_compound_literal_expr.

The testcase itself is fixed with

Index: gcc/gimplify.c
===================================================================
--- gcc/gimplify.c      (revision 271155)
+++ gcc/gimplify.c      (working copy)
@@ -4659,7 +4659,12 @@ gimplify_compound_literal_expr (tree *ex
      expression is addressable now, otherwise it is marked too late
      after we gimplify the initialization expression.  */
   if (TREE_ADDRESSABLE (*expr_p))
-    TREE_ADDRESSABLE (decl) = 1;
+    {
+      TREE_ADDRESSABLE (decl) = 1;
+      if (VECTOR_TYPE_P (TREE_TYPE (decl))
+         || TREE_CODE (TREE_TYPE (decl)) == COMPLEX_TYPE)
+       DECL_GIMPLE_REG_P (decl) = 0;
+    }
   /* Otherwise, if we don't need an lvalue and have a literal directly
      substitute it.  Check if it matches the gimple predicate, as
      otherwise we'd generate a new temporary, and we can as well just

but of course any earlier reliance of gimplifications on the DECL_GIMPLE_REG_P
check (and reliance on !TREE_ADDRESSABLE) may cause bogus gimplified IL.

Thus the above setting of TREE_ADDRESSABLE should probably be an assert
instead and the one building the COMPOUND_LITERAL (or the one setting
TREE_ADDRESSABLE on it) should also mark the decl so.

Reply via email to