gcc/testsuite/gcc.c-torture/execute/20140212-2.c
raw| 1 | /* This used to fail as we would convert f into just return (unsigned int)usVlanID |
| 2 | which is wrong. */ |
| 3 | |
| 4 | int f(unsigned short usVlanID) __attribute__((noinline,noclone)); |
| 5 | int f(unsigned short usVlanID) |
| 6 | { |
| 7 | unsigned int uiVlanID = 0xffffffff; |
| 8 | int i; |
| 9 | if ((unsigned short)0xffff != usVlanID) |
| 10 | uiVlanID = (unsigned int)usVlanID; |
| 11 | return uiVlanID; |
| 12 | } |
| 13 | |
| 14 | int main(void) |
| 15 | { |
| 16 | if (f(1) != 1) |
| 17 | __builtin_abort (); |
| 18 | if (f(0xffff) != -1) |
| 19 | __builtin_abort (); |
| 20 | return 0; |
| 21 | } |