summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-13 12:27:52 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-13 12:27:52 +0000
commitd08aa0326334346374a063e4d5ff19c055433da7 (patch)
tree3436f49c14aeb3280e83d1e20dbf698fcf66e1e5
parent38ea8a260f432bf729a9501ff9f46d7bef4101f3 (diff)
downloadgcc-d08aa0326334346374a063e4d5ff19c055433da7.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234934 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/gimplify.c6
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr70633.c12
4 files changed, 24 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1e03812a12a..1d0953bc392 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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,
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index e49bdaa627f..99c9760f85f 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 427803644da..e390840bd22 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..6d783cb3166
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr70633.c
@@ -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);
+}