aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040817-1.c19
-rw-r--r--gcc/tree-sra.c6
3 files changed, 26 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 81822a2..3e3252d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-08-17 Richard Henderson <rth@redhat.com>
+
+ PR 17051
+ * tree-sra.c (scalarize_use): Mark all v_defs for !is_output too.
+
2004-08-17 DJ Delorie <dj@redhat.com>
* doc/extend.texi: Document new xstormy16 attribute.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040817-1.c b/gcc/testsuite/gcc.c-torture/compile/20040817-1.c
new file mode 100644
index 0000000..158596c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040817-1.c
@@ -0,0 +1,19 @@
+/* PR 17051: SRA failed to rename the VOPS properly. */
+
+struct A
+{
+ char c, d;
+};
+
+void foo(struct A *p)
+{
+ struct A a = *p;
+
+ if (p->c)
+ bar1(a);
+ else
+ {
+ if (p) bar2(a,a.c);
+ bar3(a.c);
+ }
+}
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index b3fa20c..e6b254c 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1780,11 +1780,9 @@ scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
generate_copy_inout (elt, is_output, generate_element_ref (elt), &list);
if (list == NULL)
return;
+ mark_all_v_defs (expr_first (list));
if (is_output)
- {
- mark_all_v_defs (expr_first (list));
- sra_insert_after (bsi, list);
- }
+ sra_insert_after (bsi, list);
else
sra_insert_before (bsi, list);
}