summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-22 23:33:20 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-22 23:33:20 +0000
commit5a49b0e17f1e9aa8cae4e69f93cc19d6824bdf7c (patch)
treed729fab0bca584700b3abb9898aff081a36e46f9 /gcc
parentf77b9d3c8bd42fcf3a74aec63627d72be2282fe4 (diff)
downloadgcc-5a49b0e17f1e9aa8cae4e69f93cc19d6824bdf7c.tar.gz
PR tree-optimization/16721
* tree-dfa.c (dump_variable): Show TREE_THIS_VOLATILE. * tree-ssa-alias.c (create_memory_tag): Move setting of TREE_THIS_VOLATILE ... (get_tmt_for): ... here. testsuite/ChangeLog PR tree-optimization/16721 * testsuite/gcc.dg/tree-ssa/pr16721.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87895 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr16721.c15
-rw-r--r--gcc/tree-dfa.c3
-rw-r--r--gcc/tree-ssa-alias.c6
5 files changed, 34 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3680fead8be..9feec2ead0b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2004-09-22 Diego Novillo <dnovillo@redhat.com>
+
+ PR tree-optimization/16721
+ * tree-dfa.c (dump_variable): Show TREE_THIS_VOLATILE.
+ * tree-ssa-alias.c (create_memory_tag): Move setting of
+ TREE_THIS_VOLATILE ...
+ (get_tmt_for): ... here.
+
2004-09-22 Eric Botcazou <ebotcazou@libertysurf.fr>
* config/sparc/sparc.md (cmove splitter): Fix formatting.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0d7aa425772..5c6e8958fd9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-09-22 Diego Novillo <dnovillo@redhat.com>
+
+ PR tree-optimization/16721
+ * testsuite/gcc.dg/tree-ssa/pr16721.c: New test.
+
2004-09-23 Ulrich Weigand <uweigand@de.ibm.com>
* gcc.dg/20030123-1.c: Add prototypes for builtin functions.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr16721.c b/gcc/testsuite/gcc.dg/tree-ssa/pr16721.c
new file mode 100644
index 00000000000..869ab96497e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr16721.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-strict-aliasing -fdump-tree-optimized" } */
+
+struct data {
+ volatile unsigned long *addr;
+} *p;
+
+int test()
+{
+ *p->addr;
+ return 0;
+}
+
+/* The load from p->addr should not disappear. */
+/* { dg-final { scan-tree-dump-times "\->addr" 1 "optimized"} } */
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 4e65c5dffc8..9db0cbb243a 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -552,6 +552,9 @@ dump_variable (FILE *file, tree var)
if (is_global_var (var))
fprintf (file, ", is global");
+ if (TREE_THIS_VOLATILE (var))
+ fprintf (file, ", is volatile");
+
if (is_call_clobbered (var))
fprintf (file, ", call clobbered");
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index baf5ff27696..3d99d94e92e 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -2025,9 +2025,6 @@ create_memory_tag (tree type, bool is_type_tag)
determine whether they should be considered globals. */
DECL_CONTEXT (tag) = current_function_decl;
- /* If the pointed-to type is volatile, so is the tag. */
- TREE_THIS_VOLATILE (tag) = TREE_THIS_VOLATILE (type);
-
/* Memory tags are by definition addressable. This also prevents
is_gimple_ref frome confusing memory tags with optimizable
variables. */
@@ -2126,6 +2123,9 @@ get_tmt_for (tree ptr, struct alias_info *ai)
ai->pointers[ai->num_pointers++] = alias_map;
}
+ /* If the pointed-to type is volatile, so is the tag. */
+ TREE_THIS_VOLATILE (tag) = TREE_THIS_VOLATILE (tag_type);
+
/* Make sure that the type tag has the same alias set as the
pointed-to type. */
gcc_assert (tag_set == get_alias_set (tag));