OSDN Git Service

2009-04-03 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / opt / pr36187.C
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3
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;
12 };
13 static bool ImpPutDoubleFoo( SbxValues* p)
14 {
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;
36 }
37
38 int main( int argc, char** argv )
39 {
40     SbxValues aTmp;
41     aTmp.eType = SbxINTEGER;
42     if ( ImpPutDoubleFoo( &aTmp ) )
43         abort ();
44     return 0;
45 }