This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR43255
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 11 Mar 2010 16:07:14 +0100 (CET)
- Subject: [PATCH] Fix PR43255
This fixes ICEs in VRP that occur because we have some unfolded
trees.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2010-03-11 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43255
* tree-vrp.c (process_assert_insertions_for): Do not insert
asserts for trivial conditions.
* gcc.c-torture/compile/pr43255.c: New testcase.
Index: gcc/tree-vrp.c
===================================================================
*** gcc/tree-vrp.c (revision 157384)
--- gcc/tree-vrp.c (working copy)
*************** process_assert_insertions_for (tree name
*** 4836,4841 ****
--- 4836,4845 ----
edge_iterator ei;
edge e;
+ /* If we have X <=> X do not insert an assert expr for that. */
+ if (loc->expr == loc->val)
+ return false;
+
cond = build2 (loc->comp_code, boolean_type_node, loc->expr, loc->val);
assert_stmt = build_assert_expr_for (cond, name);
if (loc->e)
Index: gcc/testsuite/gcc.c-torture/compile/pr43255.c
===================================================================
*** gcc/testsuite/gcc.c-torture/compile/pr43255.c (revision 0)
--- gcc/testsuite/gcc.c-torture/compile/pr43255.c (revision 0)
***************
*** 0 ****
--- 1,33 ----
+ int safe (int);
+
+ static unsigned foo (unsigned ui1, unsigned ui2)
+ {
+ return ui1 + ui2;
+ }
+
+ int g_22;
+ int *volatile g_23 = &g_22;
+ int **g_282[8][10][1];
+ int *g_330 = &g_22;
+ volatile unsigned g_348;
+ int g_397;
+
+ void int32func (const unsigned char p_10)
+ {
+ if (foo
+ (~
+ (p_10 |
+ (*g_282[(unsigned long) g_397 % 8][(unsigned) g_22 % 10][g_348 % 1]) ==
+ (*g_282[(unsigned long) g_397 % 8][(unsigned) g_22 % 10][g_348 % 1])),
+ 1))
+ {
+ }
+ else if (*g_330 >=
+ safe (*g_23 ^
+ (**g_282[(unsigned long) g_397 % 8][(unsigned) g_22 % 10]
+ [g_348 % 1])) & **g_282[8][10][1], 1)
+ {
+ }
+ }
+
+