--- Comment #6 from rguenth at gcc dot gnu dot org 2007-03-13 09:30 ---
How tracking _two_ value ranges for signed quantities with undefined overflow.
One assuming it is undefined and one with wrapping semantics. Whenever you
fold
something using the value range you warn if the folding
--- Comment #4 from ian at airs dot com 2007-03-12 17:08 ---
First test case:
int f(int a)
{
if (a 0)
a = -a;
return a 0;
}
As far as I can tell the behaviour of this test case in VRP is unchanged by the
patch in this PR. And the code is still fully optimized.
Second test
--- Comment #5 from ian at airs dot com 2007-03-12 17:21 ---
Unfortunately my patch in comment #1 doesn't handle this test case correctly:
extern void abort (void);
void
foo (int a)
{
if (a = (int) 0x8001)
{
a = - a;
if (a 0)
abort ();
}
}
It turns
--- Comment #1 from ian at airs dot com 2007-03-11 20:39 ---
I am testing this patch.
Index: gcc/tree-vrp.c
===
--- gcc/tree-vrp.c (revision 122820)
+++ gcc/tree-vrp.c (working copy)
@@ -2142,13 +2142,11 @@
--- Comment #2 from pinskia at gcc dot gnu dot org 2007-03-12 05:43 ---
- if (supports_overflow_infinity (TREE_TYPE (expr)))
- min = positive_overflow_infinity (TREE_TYPE (expr));
- else
- {
- set_value_range_to_varying (vr);
-
--- Comment #3 from pinskia at gcc dot gnu dot org 2007-03-12 06:11 ---
How about:
extern void link_error ();
void foo (int a)
{
if (a 0)
{
int y;
a *=-2;
y = a / 7;
if (y 1 30)
link_error ();
}
}
int main()
{
return 0;
}
Also? Which is