This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH COMMITTED: Fix for PR 32169: VRP overflow infinity in cast
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 09 Jun 2007 09:33:45 -0700
- Subject: PATCH COMMITTED: Fix for PR 32169: VRP overflow infinity in cast
PR 32169 is about a case where NOP_EXPR is used on an ordinary
constant with TREE_OVERFLOW set. Converting to the smaller type
causes the constant to become an overflow infinity representation.
This happened on both sides of the range, triggering an assertion
check (we should not have overflow infinity on both sides of a range,
since that provides no information at all).
Fixed with the appended patch. Tested with bootstrap and testsuite
run on i686-pc-linux-gnu. Committed to mainline and 4.2 branch.
Ian
gcc/ChangeLog:
2007-06-09 Ian Lance Taylor <iant@google.com>
PR tree-optimization/32169
* tree-vrp.c (extract_range_from_unary_expr): For NOP_EXPR and
CONVERT_EXPR, check whether min and max both converted to an
overflow infinity representation.
gcc/testsuite/ChangeLog:
2007-06-09 Ian Lance Taylor <iant@google.com>
PR tree-optimization/32169
* gcc.c-torture/compile/pr32169.c: New test.
Index: tree-vrp.c
===================================================================
--- tree-vrp.c (revision 125521)
+++ tree-vrp.c (working copy)
@@ -2208,6 +2208,8 @@ extract_range_from_unary_expr (value_ran
&& is_gimple_val (new_max)
&& tree_int_cst_equal (new_min, orig_min)
&& tree_int_cst_equal (new_max, orig_max)
+ && (!is_overflow_infinity (new_min)
+ || !is_overflow_infinity (new_max))
&& (cmp = compare_values (new_min, new_max)) <= 0
&& cmp >= -1)
{
Index: testsuite/gcc.c-torture/compile/pr32169.c
===================================================================
--- testsuite/gcc.c-torture/compile/pr32169.c (revision 0)
+++ testsuite/gcc.c-torture/compile/pr32169.c (revision 0)
@@ -0,0 +1,17 @@
+void f(char);
+static inline
+void * __memset_generic(char c)
+{
+ f(c);
+}
+int prepare_startup_playback_urb(
+ int b,
+ int c
+)
+{
+ char d;
+ if (b)
+ __memset_generic(c == ( 1) ? 0x80 : 0);
+ else
+ __memset_generic (c == ( 1) ? 0x80 : 0);
+}