summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-13 20:51:02 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-13 20:51:02 +0000
commit70a8c47a53cee2379839901f45b6c2d2a74c81fc (patch)
tree14edb8d9ecca028be755be83d160d4682c605332
parent02b175274fd788aca55243d625bfa504c1696ff9 (diff)
downloadgcc-70a8c47a53cee2379839901f45b6c2d2a74c81fc.tar.gz
PR tree-optimization/16443
* tree-ssa-alias.c: Add more description for CALL_CLOBBERED_VARS and ADDRESSABLE_VARS. * tree-ssa-operands.c (get_asm_expr_operands): Re-order the clobbering of call-clobbered and addressable variables. If there are any before aliases have been computed, add them. testsuite/ChangeLog PR tree-optimization/16443 * gcc.dg/tree-ssa/20040713-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84641 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20040713-1.c18
-rw-r--r--gcc/tree-ssa-alias.c7
-rw-r--r--gcc/tree-ssa-operands.c17
5 files changed, 45 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8febe2abd44..0e71184813c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,14 @@
2004-07-13 Diego Novillo <dnovillo@redhat.com>
+ PR tree-optimization/16443
+ * tree-ssa-alias.c: Add more description for
+ CALL_CLOBBERED_VARS and ADDRESSABLE_VARS.
+ * tree-ssa-operands.c (get_asm_expr_operands): Re-order the
+ clobbering of call-clobbered and addressable variables. If
+ there are any before aliases have been computed, add them.
+
+2004-07-13 Diego Novillo <dnovillo@redhat.com>
+
* tree-optimize.c (execute_todo): Flush DUMP_FILE before
verification.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1089cdf1c84..19083e0362b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-13 Diego Novillo <dnovillo@redhat.com>
+
+ PR tree-optimization/16443
+ * gcc.dg/tree-ssa/20040713-1.c: New test.
+
2004-07-15 Ulrich Weigand <uweigand@de.ibm.com>
* g++.dg/lookup/new2.C: Use first operand of type __SIZE_TYPE__
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040713-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040713-1.c
new file mode 100644
index 00000000000..78919d0401a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20040713-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-Os" } */
+
+/* Extracted from PR 16443. Contributed by Volker Reichelt.
+ Scanning of __asm__ operands wasn't considering call-clobbered
+ variables discovered before the aliasing pass. This was causing a
+ crash in verify_ssa() because 'p' was not being given an SSA_NAME. */
+
+void foo(char *p)
+{
+ __asm__ ("" ::: "memory");
+}
+
+void bar()
+{
+ static char *p;
+ foo(p);
+}
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index cc0a00a559b..9da01676f43 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -164,7 +164,12 @@ static struct ptr_info_def *get_ptr_info (tree t);
bitmap call_clobbered_vars;
/* Addressable variables in the function. If bit I is set, then
- REFERENCED_VARS (I) has had its address taken. */
+ REFERENCED_VARS (I) has had its address taken. Note that
+ CALL_CLOBBERED_VARS and ADDRESSABLE_VARS are not related. An
+ addressable variable is not necessarily call-clobbered (e.g., a
+ local addressable whose address does not escape) and not all
+ call-clobbered variables are addressable (e.g., a local static
+ variable). */
bitmap addressable_vars;
/* 'true' after aliases have been computed (see compute_may_aliases). This
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 90b9d022b55..b9c5a6cf670 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -1231,16 +1231,6 @@ get_asm_expr_operands (tree stmt, voperands_t prev_vops)
{
size_t i;
- /* If we still have not computed aliasing information, we
- won't know what variables are call-clobbered and/or
- addressable. Just mark the statement as having volatile
- operands for now. */
- if (!aliases_computed_p)
- {
- stmt_ann (stmt)->has_volatile_ops = true;
- break;
- }
-
/* Clobber all call-clobbered variables (or .GLOBAL_VAR if we
decided to group them). */
if (global_var)
@@ -1259,6 +1249,13 @@ get_asm_expr_operands (tree stmt, voperands_t prev_vops)
add_stmt_operand (&var, stmt, opf_is_def, prev_vops);
});
+ /* If we don't have call-clobbered nor addressable vars and we
+ still have not computed aliasing information, just mark the
+ statement as having volatile operands. If the alias pass
+ finds some, we will add them at that point. */
+ if (!aliases_computed_p)
+ stmt_ann (stmt)->has_volatile_ops = true;
+
break;
}
}