aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-01-26 09:55:30 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-01-26 09:55:30 +0000
commite3e6cff41e9d63815a0396e02ee17d0a1261fccd (patch)
tree5b8e8a5315c9686f63ea2da022b4eaeb2c40ea42
parentdc874b53e5529e2a76d610500345e1f469366346 (diff)
downloadgcc-e3e6cff41e9d63815a0396e02ee17d0a1261fccd.zip
gcc-e3e6cff41e9d63815a0396e02ee17d0a1261fccd.tar.gz
gcc-e3e6cff41e9d63815a0396e02ee17d0a1261fccd.tar.bz2
re PR tree-optimization/38745 (ICE: statement makes a memory store, but has no VDEFS)
2009-01-26 Richard Guenther <rguenther@suse.de> PR tree-optimization/38745 * tree-ssa.c (execute_update_addresses_taken): Do not include variables that cannot possibly be a register in not_reg_needs. Do not clear TREE_ADDRESSABLE on vars that may not become registers. * tree-ssa.c (update_alias_info_1): Include those in the set of addressable vars. * g++.dg/torture/pr38745.C: New testcase. From-SVN: r143673
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/torture/pr38745.C36
-rw-r--r--gcc/tree-ssa-alias.c16
-rw-r--r--gcc/tree-ssa.c7
5 files changed, 73 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f9ca880..505c99a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,15 @@
2009-01-26 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/38745
+ * tree-ssa.c (execute_update_addresses_taken): Do not include
+ variables that cannot possibly be a register in not_reg_needs.
+ Do not clear TREE_ADDRESSABLE on vars that may not become
+ registers.
+ * tree-ssa.c (update_alias_info_1): Include those in the set
+ of addressable vars.
+
+2009-01-26 Richard Guenther <rguenther@suse.de>
+
PR middle-end/38851
* Makefile.in (tree-ssa-dse.o): Add langhooks.h.
* tree-ssa-dse.c: Include langhooks.h
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ea1493a..5743ae0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2009-01-26 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/38745
+ * g++.dg/torture/pr38745.C: New testcase.
+
+2009-01-26 Richard Guenther <rguenther@suse.de>
+
PR middle-end/38851
* g++.dg/warn/Wuninitialized-1.C: New testcase.
diff --git a/gcc/testsuite/g++.dg/torture/pr38745.C b/gcc/testsuite/g++.dg/torture/pr38745.C
new file mode 100644
index 0000000..4ad9d85
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr38745.C
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+
+union u_u16
+{
+ unsigned short v;
+ struct
+ {
+ unsigned char lo8, hi8;
+ } __attribute__ ((__may_alias__)) u;
+} __attribute__ ((__may_alias__));
+union u_u32
+{
+ unsigned int v;
+ struct
+ {
+ u_u16 lo16, hi16;
+ } u;
+} __attribute__ ((__may_alias__));
+union u_u64
+{
+ struct
+ {
+ u_u32 lo32, hi32;
+ } u;
+};
+struct Record
+{
+};
+long long
+UnpackFullKey (Record & rec, const char *&p)
+{
+ long long c64 = 0;
+ (*(u_u16 *) & (*(u_u32 *) & ( *(u_u64*)&c64).u.lo32.v).u.lo16.v).u.hi8 = 1;
+ return c64;
+}
+
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 4e9d28b..9ed242d 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -2483,6 +2483,22 @@ update_alias_info_1 (gimple stmt, struct alias_info *ai)
if (addr_taken)
bitmap_ior_into (gimple_addressable_vars (cfun), addr_taken);
+ /* If we have a call or an assignment, see if the lhs contains
+ a local decl that requires not to be a gimple register. */
+ if (gimple_code (stmt) == GIMPLE_ASSIGN
+ || gimple_code (stmt) == GIMPLE_CALL)
+ {
+ tree lhs = gimple_get_lhs (stmt);
+ /* A plain decl does not need it set. */
+ if (lhs && handled_component_p (lhs))
+ {
+ tree var = get_base_address (lhs);
+ if (DECL_P (var)
+ && is_gimple_reg_type (TREE_TYPE (var)))
+ bitmap_set_bit (gimple_addressable_vars (cfun), DECL_UID (var));
+ }
+ }
+
/* Process each operand use. For pointers, determine whether they
are dereferenced by the statement, or whether their value
escapes, etc. */
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 935cad6..91cbc19 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1731,7 +1731,12 @@ execute_update_addresses_taken (void)
|| bitmap_bit_p (addresses_taken, DECL_UID (var)))
continue;
- if (TREE_ADDRESSABLE (var))
+ if (TREE_ADDRESSABLE (var)
+ /* Do not change TREE_ADDRESSABLE if we need to preserve var as
+ a non-register. Otherwise we are confused and forget to
+ add virtual operands for it. */
+ && (!is_gimple_reg_type (TREE_TYPE (var))
+ || !bitmap_bit_p (not_reg_needs, DECL_UID (var))))
{
TREE_ADDRESSABLE (var) = 0;
if (is_gimple_reg (var))