| 1 |
/* PR middle-end/18548 */ |
| 2 |
/* Test case reduced by Andrew Pinski <[email protected]> */ |
| 3 |
/* { dg-do run } */ |
| 4 |
/* { dg-options "-O1 " } */ |
| 5 |
/* Option -fno-tree-lrs removed By Andrew MacLeod since it is no longer |
| 6 |
supported in the compiler beginning with GCC 4.3. */ |
| 7 |
/* m32c has varying sized pointers */ |
| 8 |
/* { dg-skip-if "" { "m32c-*-*" } { "*" } { "-mcpu=m32c" "-mcpu=m32cm" } } */ |
| 9 |
|
| 10 |
__extension__ typedef __INTPTR_TYPE__ intptr_t; |
| 11 |
|
| 12 |
extern void abort (void); |
| 13 |
|
| 14 |
intptr_t fff[10]; |
| 15 |
|
| 16 |
void f(intptr_t a, intptr_t b) |
| 17 |
{ |
| 18 |
intptr_t crcc = b; |
| 19 |
intptr_t d = *((intptr_t*)(a+1)); |
| 20 |
int i; |
| 21 |
|
| 22 |
a = d >= b? d:b; |
| 23 |
|
| 24 |
|
| 25 |
for(i=0;i<10;i++) |
| 26 |
fff[i] = a; |
| 27 |
} |
| 28 |
|
| 29 |
/* The variable a cannot be a local variable as we get better aliasing |
| 30 |
now and decide that the store to a is dead. The better aliasing comes |
| 31 |
from better representation of pointer arithmetic. */ |
| 32 |
intptr_t a = 10; |
| 33 |
int main(void) |
| 34 |
{ |
| 35 |
int i; |
| 36 |
f((intptr_t)(&a)-1,0); |
| 37 |
for(i = 0;i<10;i++) |
| 38 |
if (fff[i]!=10) |
| 39 |
abort (); |
| 40 |
return 0; |
| 41 |
} |
| 42 |
|