re PR target/70633 (ICE on valid code at -Os (in 32-bit mode) on x86_64-linux-gnu...
authorJakub Jelinek <jakub@redhat.com>
Wed, 13 Apr 2016 12:27:52 +0000 (14:27 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 13 Apr 2016 12:27:52 +0000 (14:27 +0200)
PR middle-end/70633
* gimplify.c (gimplify_init_constructor): Clear TREE_STATIC if
gimplification turns some element into non-constant.

* gcc.c-torture/compile/pr70633.c: New test.

From-SVN: r234934

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr70633.c [new file with mode: 0644]

index 1e03812a12a843c7b45c561c88e122953833af53..1d0953bc392025079cb83ce38bcb8c234882e893 100644 (file)
@@ -1,5 +1,9 @@
 2016-04-13  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/70633
+       * gimplify.c (gimplify_init_constructor): Clear TREE_STATIC if
+       gimplification turns some element into non-constant.
+
        PR debug/70628
        * rtl.h (convert_memory_address_addr_space_1): New prototype.
        * explow.c (convert_memory_address_addr_space_1): No longer static,
index e49bdaa627f6c4e0a36474f2321feb4550438516..99c9760f85f52a000bfe9eff1e158532329050ce 100644 (file)
@@ -4164,7 +4164,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
          }
 
        /* Vector types use CONSTRUCTOR all the way through gimple
-         compilation as a general initializer.  */
+          compilation as a general initializer.  */
        FOR_EACH_VEC_SAFE_ELT (elts, ix, ce)
          {
            enum gimplify_status tret;
@@ -4172,6 +4172,10 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
                                  fb_rvalue);
            if (tret == GS_ERROR)
              ret = GS_ERROR;
+           else if (TREE_STATIC (ctor)
+                    && !initializer_constant_valid_p (ce->value,
+                                                      TREE_TYPE (ce->value)))
+             TREE_STATIC (ctor) = 0;
          }
        if (!is_gimple_reg (TREE_OPERAND (*expr_p, 0)))
          TREE_OPERAND (*expr_p, 1) = get_formal_tmp_var (ctor, pre_p);
index 427803644dac7aa8990a425eb15a8a1d0f9ac47b..e390840bd2277c3553e1ec0ee5c8bfc9b1c24d1c 100644 (file)
@@ -1,5 +1,8 @@
 2016-04-13  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/70633
+       * gcc.c-torture/compile/pr70633.c: New test.
+
        PR debug/70628
        * gcc.dg/torture/pr70628.c: New test.
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr70633.c b/gcc/testsuite/gcc.c-torture/compile/pr70633.c
new file mode 100644 (file)
index 0000000..6d783cb
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR middle-end/70633 */
+
+typedef long V __attribute__((vector_size (4 * sizeof (long))));
+
+void foo (V *);
+
+void
+bar (void)
+{ 
+  V b = { (long) bar, 0, 0, 0 };
+  foo (&b);
+}