2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.brendan / code-gen4.C
blob80b1676cd587fa6057ca6c2398380e822fa86191
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.
11 // Workaround - declare "f1_arg" as type "short int".
13 #include <stdio.h>
14 #include <stdlib.h>
16 short int v2;
18 long v1 = 0x11117777;
20 inline void f1 (long f1_arg)
22         v2 = f1_arg;
25 int main ()
27         f1 (v1);
29         if (v2 != 0x00007777)
30           abort ();
31         else
32           printf ("PASS\n");