2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / g++.dg / opt / pr36187.C
blobfdb468d5a0a145ad16b2170b8aa4c33064682d1e
1 /* { dg-do run } */
2 /* { dg-options "-O2 --param max-aliased-vops=20" } */
4 extern "C" void abort (void);
5 enum SbxDataType { SbxINTEGER, SbxDECIMAL, SbxBYREF = 0x4000 };
6 struct SbxValues {
7     union {
8         float nSingle;
9         float* pSingle;
10     };
11     SbxDataType eType;
13 static bool ImpPutDoubleFoo( SbxValues* p)
15     bool bRet = false;
16     SbxValues aTmp;
17     int count = 0;
18 start: 
19     switch( p->eType )  {  
20         case SbxINTEGER:
21             if (count++ > 0)
22               abort ();
23             aTmp.pSingle = &p->nSingle; goto direct;
24         case SbxBYREF | SbxDECIMAL:
25             bRet = false;
26             break;
27         direct:
28             aTmp.eType = SbxDataType( p->eType | SbxBYREF );
29             p = &aTmp; goto start;
30         case SbxBYREF | SbxINTEGER:
31             break;
32         default:
33             bRet =true;
34     }
35     return bRet;
38 int main( int argc, char** argv )
40     SbxValues aTmp;
41     aTmp.eType = SbxINTEGER;
42     if ( ImpPutDoubleFoo( &aTmp ) )
43         abort ();
44     return 0;