| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-ccp1 -W -Wall" } */ |
| 3 |
#if (__SIZEOF_INT__ == __SIZEOF_FLOAT__) |
| 4 |
typedef int intflt; |
| 5 |
#elif (__SIZEOF_LONG__ == __SIZEOF_FLOAT__) |
| 6 |
typedef long intflt; |
| 7 |
#else |
| 8 |
#error Add target support here for type that will union float size |
| 9 |
#endif |
| 10 |
|
| 11 |
intflt b; |
| 12 |
void f(void) |
| 13 |
{ |
| 14 |
float a; |
| 15 |
a = 1; |
| 16 |
b = *(intflt*)&a; /* { dg-warning "aliasing" } */ |
| 17 |
} |
| 18 |
|
| 19 |
/* We should be able to convert the cast to a VCE in forwprop1, |
| 20 |
even if there is an aliasing violation. |
| 21 |
??? While this would be useful and nice to our users in this |
| 22 |
particular situation before doing this transformation we have to |
| 23 |
assure that a is killed by a dominating store via type float for |
| 24 |
it to be valid. Then we might as well handle the situation by |
| 25 |
value-numbering, removing the load altogether. |
| 26 |
??? We now do this after CPP re-writes a into SSA form. */ |
| 27 |
/* { dg-final { scan-tree-dump-times "VIEW_CONVERT_EXPR" 1 "ccp1" } } */ |
| 28 |
|
| 29 |
/* The invalid access above may also trigger -Wuninitialized. |
| 30 |
{ dg-prune-output "-Wuninitialized" } */ |