gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-signed-unsigned.C
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */ |
| 3 | |
| 4 | typedef int int32_t __attribute__((mode (__SI__))); |
| 5 | typedef unsigned uint32_t __attribute__((mode (__SI__))); |
| 6 | |
| 7 | int32_t foo () { |
| 8 | int32_t i; |
| 9 | uint32_t* pu = reinterpret_cast<uint32_t*> (&i); /* { dg-bogus "signed vs. unsigned" } */ |
| 10 | *pu = 1000000; |
| 11 | return i; |
| 12 | } |