Fix PR48484
[official-gcc.git] / gcc / testsuite / g++.dg / pr48484.C
blob3f17f39a0a18a11a6cacca613e69c838a0a323fc
1 /* { dg-do compile } */
2 /* { dg-options "-O -finline-functions -finline-small-functions -Wuninitialized" }  */
5 struct SQObjectPtr
7   int _type;
8   SQObjectPtr operator = (long);
9 };
10 struct SQObjectPtrVec
12   SQObjectPtr fff (unsigned);
13   SQObjectPtr *_vals;
16 struct SQInstruction
18   int _arg1;
19   unsigned op;
20   unsigned _arg0;
21   unsigned _arg2;
23 struct SQVM
25   struct CallInfo
26   {
27     SQInstruction *_ip;
28   };
29     bool
30     Execute (SQObjectPtr &, long, long, long, SQObjectPtr &, unsigned, int);
31     bool
32     FOREACH_OP
33     (SQObjectPtr
34      &, SQObjectPtr &, SQObjectPtr &, SQObjectPtr &, long, int, int &);
35   SQObjectPtrVec _stack;
36   CallInfo *ci;
37   long _nnativecalls;
38   bool ShouldSuspend ();
40 struct AutoDec
42   AutoDec (long *);
43    ~AutoDec ();
45 bool
46   SQVM::FOREACH_OP
47   (SQObjectPtr
48    &
49    o1,
50    SQObjectPtr & o2, SQObjectPtr &, SQObjectPtr & o4, long, int, int &jump)
52   long
53     nrefidx = 0;
54   switch (o1._type)
55     {
56     case 0x02000000:
57       o4 = nrefidx;
58       jump = 1;
59       return true;
60     case 0x00000080:
61       {
62         long
63           idx = 10;
64         o2 = idx;
65         jump = 0;
66       }
67     }
70 bool
71   SQVM::Execute
72   (SQObjectPtr &, long, long, long, SQObjectPtr &, unsigned, int)
74   AutoDec
75   ad (&_nnativecalls);
76   for (;;)
77     {
78       if (ShouldSuspend ())
79         return true;
80       SQInstruction
81         _i_ = *ci->_ip;
82       switch (_i_.op)
83         {
84         case 0:
85           {
86             int
87               tojump;
89             FOREACH_OP
90               (_stack._vals
91                [_i_._arg0],
92                _stack._vals
93                [_i_._arg2],
94                _stack._vals
95                [_i_._arg2],
96                _stack._vals[_i_._arg2], _i_._arg2, _i_._arg1, tojump);
98             ci += tojump;  /* { dg-warning "uninitialized" "warning" }  */
99           }
100         case 1:
101           _stack.fff (_i_._arg1);
102         }
103     }