aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-11 01:12:00 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-11 01:12:00 +0000
commit24ebc2da2cc28d1a99397f5d3212669ab6057f49 (patch)
treee13cccad63e2732354ed53099b2e0d7ebf7bd5b7
parentbc66e52b1cc4c0bc1283be9a817474944873be68 (diff)
* tree-nested.c (convert_nonlocal_reference): Clear TREE_INVARIANT
on modified ADDR_EXPRs. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@79291 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.tree-ssa5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040310-1.c10
-rw-r--r--gcc/tree-nested.c17
3 files changed, 27 insertions, 5 deletions
diff --git a/gcc/ChangeLog.tree-ssa b/gcc/ChangeLog.tree-ssa
index 37c6e37749e..cebd082b67f 100644
--- a/gcc/ChangeLog.tree-ssa
+++ b/gcc/ChangeLog.tree-ssa
@@ -1,3 +1,8 @@
+2004-03-10 Richard Henderson <rth@redhat.com>
+
+ * tree-nested.c (convert_nonlocal_reference): Clear TREE_INVARIANT
+ on modified ADDR_EXPRs.
+
2004-03-10 Andrew Pinski <apinski@apple.com
PR c/14475
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040310-1.c b/gcc/testsuite/gcc.c-torture/compile/20040310-1.c
new file mode 100644
index 00000000000..f0c85f0ada5
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040310-1.c
@@ -0,0 +1,10 @@
+void I_wacom ()
+{
+ char buffer[50], *p;
+ int RequestData (char *cmd)
+ {
+ p = buffer;
+ foo (buffer);
+ }
+ RequestData (0);
+}
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 2a78b71e1de..9f5331cea17 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -763,11 +763,18 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
walk_tree (&TREE_OPERAND (t, 0), convert_nonlocal_reference, wi, NULL);
wi->val_only = save_val_only;
- /* If the callback converted the address argument in a context
- where we only accept variables (and min_invariant, presumably),
- then compute the address into a temporary. */
- if (save_val_only && save_sub != TREE_OPERAND (t, 0))
- *tp = gimplify_val (wi->info, t, &wi->tsi);
+ if (save_sub != TREE_OPERAND (t, 0))
+ {
+ /* If we changed anything, then TREE_INVARIANT is be wrong,
+ since we're no longer directly referencing a decl. */
+ TREE_INVARIANT (t) = 0;
+
+ /* If the callback converted the address argument in a context
+ where we only accept variables (and min_invariant, presumably),
+ then compute the address into a temporary. */
+ if (save_val_only)
+ *tp = gimplify_val (wi->info, t, &wi->tsi);
+ }
}
break;