| 1 |
// { dg-do run } |
| 2 |
// { dg-options "-O" } |
| 3 |
// GROUPS passed code-generation |
| 4 |
// Options: -O |
| 5 |
// |
| 6 |
// Check that when an int value is assigned to a short int, the proper |
| 7 |
// half of the int (i.e. the low order half) ends up in the short. |
| 8 |
// |
| 9 |
// This fails with 1.32.0 with -O and f1() is inline. |
| 10 |
// |
| 11 |
// Workaround - declare "f1_arg" as type "short int". |
| 12 |
|
| 13 |
#include <stdio.h> |
| 14 |
#include <stdlib.h> |
| 15 |
|
| 16 |
short int v2; |
| 17 |
|
| 18 |
long v1 = 0x11117777; |
| 19 |
|
| 20 |
inline void f1 (long f1_arg) |
| 21 |
{ |
| 22 |
v2 = f1_arg; |
| 23 |
} |
| 24 |
|
| 25 |
int main () |
| 26 |
{ |
| 27 |
f1 (v1); |
| 28 |
|
| 29 |
if (v2 != 0x00007777) |
| 30 |
abort (); |
| 31 |
else |
| 32 |
printf ("PASS\n"); |
| 33 |
} |