mirror of git://gcc.gnu.org/git/gcc.git
re PR tree-optimization/43017 (VRP miscompiles python with -fwrapv, II)
2010-02-10 Richard Guenther <rguenther@suse.de> PR tree-optimization/43017 * tree-vrp.c (vrp_int_const_binop): Trust int_const_binop for wrapping signed arithmetic. * gcc.dg/torture/pr43017.c: New testcase. From-SVN: r156666
This commit is contained in:
parent
7fcd5ad54c
commit
5418fe84c2
|
|
@ -1,3 +1,9 @@
|
||||||
|
2010-02-10 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
|
PR tree-optimization/43017
|
||||||
|
* tree-vrp.c (vrp_int_const_binop): Trust int_const_binop
|
||||||
|
for wrapping signed arithmetic.
|
||||||
|
|
||||||
2010-02-10 Jakub Jelinek <jakub@redhat.com>
|
2010-02-10 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR debug/43010
|
PR debug/43010
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
2010-02-10 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
|
PR tree-optimization/43017
|
||||||
|
* gcc.dg/torture/pr43017.c: New testcase.
|
||||||
|
|
||||||
2010-02-10 Tobias Burnus <burnus@net-b.de>
|
2010-02-10 Tobias Burnus <burnus@net-b.de>
|
||||||
|
|
||||||
PR fortran/40823
|
PR fortran/40823
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
/* { dg-do run } */
|
||||||
|
/* { dg-options "-fwrapv" } */
|
||||||
|
|
||||||
|
signed char foo(unsigned char c2)
|
||||||
|
{
|
||||||
|
signed char c2_22;
|
||||||
|
|
||||||
|
if (c2 <= 63 || c2 == 127)
|
||||||
|
goto bb43;
|
||||||
|
else
|
||||||
|
goto bb20;
|
||||||
|
|
||||||
|
bb20:
|
||||||
|
if (c2 > 252)
|
||||||
|
goto bb43;
|
||||||
|
else
|
||||||
|
goto bb21;
|
||||||
|
|
||||||
|
bb21:
|
||||||
|
/*...*/;
|
||||||
|
|
||||||
|
bb24:
|
||||||
|
c2_22 = (signed char)c2;
|
||||||
|
if (c2_22 >= 0)
|
||||||
|
goto bb25;
|
||||||
|
else
|
||||||
|
goto bb26;
|
||||||
|
|
||||||
|
bb25:
|
||||||
|
c2 = (unsigned char)(c2_22 - 64);
|
||||||
|
goto bb27;
|
||||||
|
|
||||||
|
bb26:
|
||||||
|
c2 = (unsigned char)(c2_22 - 65);
|
||||||
|
|
||||||
|
bb27:
|
||||||
|
if (c2 <= 93)
|
||||||
|
goto bb28;
|
||||||
|
else
|
||||||
|
goto bb29;
|
||||||
|
|
||||||
|
bb28:
|
||||||
|
c2 = c2 + 33;
|
||||||
|
goto bb30;
|
||||||
|
|
||||||
|
bb29:
|
||||||
|
c2 = (unsigned char)((signed char)c2 - 61);
|
||||||
|
|
||||||
|
bb30:
|
||||||
|
return c2;
|
||||||
|
|
||||||
|
bb43:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
extern void abort (void);
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
signed char res[256] = {
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
33, 34, 35, 36, 37, 38, 39, 40,
|
||||||
|
41, 42, 43, 44, 45, 46, 47, 48,
|
||||||
|
49, 50, 51, 52, 53, 54, 55, 56,
|
||||||
|
57, 58, 59, 60, 61, 62, 63, 64,
|
||||||
|
65, 66, 67, 68, 69, 70, 71, 72,
|
||||||
|
73, 74, 75, 76, 77, 78, 79, 80,
|
||||||
|
81, 82, 83, 84, 85, 86, 87, 88,
|
||||||
|
89, 90, 91, 92, 93, 94, 95, -1,
|
||||||
|
96, 97, 98, 99, 100, 101, 102, 103,
|
||||||
|
104, 105, 106, 107, 108, 109, 110, 111,
|
||||||
|
112, 113, 114, 115, 116, 117, 118, 119,
|
||||||
|
120, 121, 122, 123, 124, 125, 126, 33,
|
||||||
|
34, 35, 36, 37, 38, 39, 40, 41,
|
||||||
|
42, 43, 44, 45, 46, 47, 48, 49,
|
||||||
|
50, 51, 52, 53, 54, 55, 56, 57,
|
||||||
|
58, 59, 60, 61, 62, 63, 64, 65,
|
||||||
|
66, 67, 68, 69, 70, 71, 72, 73,
|
||||||
|
74, 75, 76, 77, 78, 79, 80, 81,
|
||||||
|
82, 83, 84, 85, 86, 87, 88, 89,
|
||||||
|
90, 91, 92, 93, 94, 95, 96, 97,
|
||||||
|
98, 99, 100, 101, 102, 103, 104, 105,
|
||||||
|
106, 107, 108, 109, 110, 111, 112, 113,
|
||||||
|
114, 115, 116, 117, 118, 119, 120, 121,
|
||||||
|
122, 123, 124, 125, 126, -1, -1, -1
|
||||||
|
};
|
||||||
|
unsigned int c;
|
||||||
|
for (c = 0; c <= 255; ++c)
|
||||||
|
{
|
||||||
|
if (foo (c) != res[c])
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -1937,6 +1937,10 @@ vrp_int_const_binop (enum tree_code code, tree val1, tree val2)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (TYPE_OVERFLOW_WRAPS (TREE_TYPE (val1)))
|
||||||
|
/* If the singed operation wraps then int_const_binop has done
|
||||||
|
everything we want. */
|
||||||
|
;
|
||||||
else if ((TREE_OVERFLOW (res)
|
else if ((TREE_OVERFLOW (res)
|
||||||
&& !TREE_OVERFLOW (val1)
|
&& !TREE_OVERFLOW (val1)
|
||||||
&& !TREE_OVERFLOW (val2))
|
&& !TREE_OVERFLOW (val2))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue