re PR tree-optimization/41919 (optimized code with -O2 or -O3 gives strange result)
2009-11-04 Richard Guenther <rguenther@suse.de> PR tree-optimization/41919 * tree-vrp.c (test_for_singularity): Properly compare values. * gcc.c-torture/execute/pr41919.c: New testcase. From-SVN: r153891
This commit is contained in:
parent
db5e2d51eb
commit
fbd4382774
3 changed files with 46 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
2009-11-04 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/41919
|
||||
* gcc.c-torture/execute/pr41919.c: New testcase.
|
||||
|
||||
2009-11-04 Carlos O'Donell <carlos@codesourcery.com>
|
||||
|
||||
PR target/41302
|
||||
|
|
39
gcc/testsuite/gcc.c-torture/execute/pr41919.c
Normal file
39
gcc/testsuite/gcc.c-torture/execute/pr41919.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
extern void abort (void);
|
||||
|
||||
#define assert(x) if(!(x)) abort()
|
||||
|
||||
struct S1
|
||||
{
|
||||
char f0;
|
||||
};
|
||||
|
||||
int g_23 = 0;
|
||||
|
||||
static struct S1
|
||||
foo (void)
|
||||
{
|
||||
int *l_100 = &g_23;
|
||||
int **l_110 = &l_100;
|
||||
struct S1 l_128 = { 1 };
|
||||
assert (l_100 == &g_23);
|
||||
assert (l_100 == &g_23);
|
||||
assert (l_100 == &g_23);
|
||||
assert (l_100 == &g_23);
|
||||
assert (l_100 == &g_23);
|
||||
assert (l_100 == &g_23);
|
||||
assert (l_100 == &g_23);
|
||||
return l_128;
|
||||
}
|
||||
|
||||
static char bar(char si1, char si2)
|
||||
{
|
||||
return (si1 <= 0) ? si1 : (si2 * 2);
|
||||
}
|
||||
int main (void)
|
||||
{
|
||||
struct S1 s = foo();
|
||||
if (bar(0x99 ^ (s.f0 && 1), 1) != -104)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -6748,13 +6748,9 @@ test_for_singularity (enum tree_code cond_code, tree op0,
|
|||
value range information we have for op0. */
|
||||
if (min && max)
|
||||
{
|
||||
if (compare_values (vr->min, min) == -1)
|
||||
min = min;
|
||||
else
|
||||
if (compare_values (vr->min, min) == 1)
|
||||
min = vr->min;
|
||||
if (compare_values (vr->max, max) == 1)
|
||||
max = max;
|
||||
else
|
||||
if (compare_values (vr->max, max) == -1)
|
||||
max = vr->max;
|
||||
|
||||
/* If the new min/max values have converged to a single value,
|
||||
|
|
Loading…
Add table
Reference in a new issue