[4.3 PATCH] Fix vector x = y = (vectortype) { ... } (PR tree-optimization/36991)
Jakub Jelinek
jakub@redhat.com
Fri Aug 1 14:09:00 GMT 2008
Hi!
On the 4.3 branch when gimplify_init_constructor is called with MODIFY_EXPR
and want_value is true (e.g. when the result of assignment is assigned to
another var), gimplify_init_constructor appends the MODIFY_EXPR to pre_p,
which means it is never converted to GIMPLE_MODIFY_STMT.
On the trunk this problem obviously doesn't exist after tuples merge ;)
Will commit after bootstrap/regtesting it (+ testcase to the trunk too).
2008-08-01 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/36991
* gimplify.c (gimplify_init_constructor): Call tree_to_gimple_tuple
on expr_p before appending it to pre_p.
* gcc.dg/pr36991.c: New test.
--- gcc/gimplify.c.jj 2008-06-06 21:26:14.000000000 +0200
+++ gcc/gimplify.c 2008-08-01 15:51:55.000000000 +0200
@@ -3044,6 +3044,8 @@ zero_sized_type (const_tree type)
return false;
}
+static void tree_to_gimple_tuple (tree *);
+
/* A subroutine of gimplify_init_constructor. Generate individual
MODIFY_EXPRs for a CONSTRUCTOR. OBJECT is the LHS against which the
assignments should happen. ELTS is the CONSTRUCTOR_ELTS of the
@@ -3452,6 +3454,8 @@ gimplify_init_constructor (tree *expr_p,
return GS_ERROR;
else if (want_value)
{
+ tree_to_gimple_tuple (expr_p);
+
append_to_statement_list (*expr_p, pre_p);
*expr_p = object;
return GS_OK;
--- gcc/testsuite/gcc.dg/pr36991.c.jj 2008-08-01 16:02:55.000000000 +0200
+++ gcc/testsuite/gcc.dg/pr36991.c 2008-08-01 16:02:35.000000000 +0200
@@ -0,0 +1,12 @@
+/* PR tree-optimization/36991 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef float V __attribute__ ((vector_size (16)));
+typedef union { V v[4][4]; } U;
+
+void
+foo (float x, float y, U *z)
+{
+ z->v[1][0] = z->v[0][1] = (V) { x, y, 0, 0 };
+}
Jakub
More information about the Gcc-patches
mailing list