]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/42730 (ice: verify_stmts failed)
authorRichard Guenther <rguenther@suse.de>
Wed, 13 Jan 2010 22:21:25 +0000 (22:21 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 13 Jan 2010 22:21:25 +0000 (22:21 +0000)
2010-01-13  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/42730
* tree-ssa-ccp.c (maybe_fold_stmt_indirect): Add shortcut for
offset zero.

* gcc.c-torture/compile/pr42730.c: New testcase.

From-SVN: r155872

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr42730.c [new file with mode: 0644]
gcc/tree-ssa-ccp.c

index 68edaec671665fa16dc6a86ed0ceae6859f4644c..a73cb95d90ccdf3cc32b15c306c199d3584e2eae 100644 (file)
@@ -1,3 +1,9 @@
+2010-01-13  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/42730
+       * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Add shortcut for
+       offset zero.
+
 2010-01-13  Steve Ellcey  <sje@cup.hp.com>
 
        PR target/pr42542
index 16a0e7852b0cdc70088f2c4501a03baaec85c781..6484dd8c6183c5636c11599352017467b0737830 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-13  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/42730
+       * gcc.c-torture/compile/pr42730.c: New testcase.
+
 2010-01-13  Steve Ellcey  <sje@cup.hp.com>
 
        PR target/pr42542
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42730.c b/gcc/testsuite/gcc.c-torture/compile/pr42730.c
new file mode 100644 (file)
index 0000000..89aaafe
--- /dev/null
@@ -0,0 +1,14 @@
+union bzz
+{
+  unsigned *pa;
+  void *pv;
+};
+
+void foo (void)
+{
+  union bzz u;
+  void **x;
+  void *y = 0;
+  x = &u.pv;
+  *x = y;
+}
index f3f113c902f28a20a49ad62b127ddd72f05afb5d..b40dba36d081d206a1985bd4a96d2c32918092ac 100644 (file)
@@ -2120,6 +2120,10 @@ maybe_fold_stmt_indirect (tree expr, tree base, tree offset)
          && is_gimple_min_invariant (DECL_INITIAL (base)))
        return DECL_INITIAL (base);
 
+      /* If there is no offset involved simply return the folded base.  */
+      if (integer_zerop (offset))
+       return base;
+
       /* Try folding *(&B+O) to B.X.  */
       t = maybe_fold_offset_to_reference (loc, base_addr, offset,
                                          TREE_TYPE (expr));