From: Richard Guenther Date: Wed, 13 Jan 2010 22:21:25 +0000 (+0000) Subject: re PR tree-optimization/42730 (ice: verify_stmts failed) X-Git-Tag: releases/gcc-4.5.0~1248 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5db959b6480186de1df9242f5b91d5e7fa75c30a;p=thirdparty%2Fgcc.git re PR tree-optimization/42730 (ice: verify_stmts failed) 2010-01-13 Richard Guenther 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 68edaec67166..a73cb95d90cc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-01-13 Richard Guenther + + PR tree-optimization/42730 + * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Add shortcut for + offset zero. + 2010-01-13 Steve Ellcey PR target/pr42542 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 16a0e7852b0c..6484dd8c6183 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-01-13 Richard Guenther + + PR tree-optimization/42730 + * gcc.c-torture/compile/pr42730.c: New testcase. + 2010-01-13 Steve Ellcey 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 index 000000000000..89aaafe870a6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr42730.c @@ -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; +} diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index f3f113c902f2..b40dba36d081 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -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));