1 /*
2    20030714-1.c from the execute part of the gcc torture tests.
3  */
4 
5 #include <testfwk.h>
6 
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
10 
11 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15)
12 #if !(defined (__GNUC__) && defined (__GNUC_MINOR__) && (__GNUC__ < 5))
13 /* derived from PR optimization/11440  */
14 
15 typedef _Bool bool;
16 const bool false = 0;
17 const bool true = 1;
18 
19 enum EPosition
20 {
21   STATIC, RELATIVE, ABSOLUTE, FIXED
22 };
23 typedef enum EPosition EPosition;
24 
25 enum EFloat
26 {
27   FNONE = 0, FLEFT, FRIGHT
28 };
29 typedef enum EFloat EFloat;
30 
31 struct RenderBox
32 {
33   int unused[6];
34   short m_verticalPosition;
35 
36   bool m_layouted : 1;
37   bool m_unused : 1;
38   bool m_minMaxKnown : 1;
39   bool m_floating : 1;
40 
41   bool m_positioned : 1;
42   bool m_overhangingContents : 1;
43   bool m_relPositioned : 1;
44   bool m_paintSpecial : 1;
45 
46   bool m_isAnonymous : 1;
47   bool m_recalcMinMax : 1;
48   bool m_isText : 1;
49   bool m_inline : 1;
50 
51   bool m_replaced : 1;
52   bool m_mouseInside : 1;
53   bool m_hasFirstLine : 1;
54   bool m_isSelectionBorder : 1;
55 
56   bool (*isTableCell) (struct RenderBox *this);
57 };
58 
59 typedef struct RenderBox RenderBox;
60 
61 struct RenderStyle
62 {
63   struct NonInheritedFlags
64     {
65       union
66 	{
67 	  struct
68 	    {
69 	      unsigned int _display : 4;
70 	      unsigned int _bg_repeat : 2;
71 	      bool _bg_attachment : 1;
72 	      unsigned int _overflow : 4 ;
73 	      unsigned int _vertical_align : 4;
74 	      unsigned int _clear : 2;
75 	      EPosition _position : 2;
76 	      EFloat _floating : 2;
77 	      unsigned int _table_layout : 1;
78 	      bool _flowAroundFloats :1;
79 
80 	      unsigned int _styleType : 3;
81 	      bool _hasHover : 1;
82 	      bool _hasActive : 1;
83 	      bool _clipSpecified : 1;
84 	      unsigned int _unicodeBidi : 2;
85 	      int _unused : 1;
86 	    } f;
87 	  int _niflags;
88 	};
89     } noninherited_flags;
90 };
91 
92 typedef struct RenderStyle RenderStyle;
93 
94 extern void RenderObject_setStyle(RenderBox *this, RenderStyle *_style);
95 extern void removeFromSpecialObjects(RenderBox *this);
96 
97 
98 
RenderBox_setStyle(RenderBox * thisin,RenderStyle * _style)99 void RenderBox_setStyle(RenderBox *thisin, RenderStyle *_style)
100 {
101   RenderBox *this = thisin;
102   bool oldpos, tmp;
103   EPosition tmppo;
104 
105   tmp = this->m_positioned;
106 
107   oldpos = tmp;
108 
109   RenderObject_setStyle(this, _style);
110 
111   tmppo = _style->noninherited_flags.f._position;
112 
113   switch(tmppo)
114     {
115     case ABSOLUTE:
116     case FIXED:
117 	{
118 	  bool ltrue = true;
119 	  this->m_positioned = ltrue;
120 	  break;
121 	}
122 
123     default:
124 	{
125 	  EFloat tmpf;
126 	  EPosition tmpp;
127 	  if (oldpos)
128 	    {
129 	      bool ltrue = true;
130 	      this->m_positioned = ltrue;
131 	      removeFromSpecialObjects(this);
132 	    }
133 	    {
134 	      bool lfalse = false;
135 	      this->m_positioned = lfalse;
136 	    }
137 
138 	  tmpf = _style->noninherited_flags.f._floating;
139 
140 	  if(!this->isTableCell (this) && !(tmpf == FNONE))
141 	    {
142 	      bool ltrue = true;
143 	      this->m_floating = ltrue;
144 	    }
145 	  else
146 	    {
147 	      tmpp = _style->noninherited_flags.f._position;
148 	      if (tmpp == RELATIVE)
149 		{
150 		  bool ltrue = true;
151 		  this->m_relPositioned = ltrue;
152 		}
153 	    }
154 	}
155     }
156 }
157 
158 
159 
160 
161 RenderBox g_this;
162 RenderStyle g__style;
163 
RenderObject_setStyle(RenderBox * this,RenderStyle * _style)164 void RenderObject_setStyle(RenderBox *this, RenderStyle *_style)
165 {
166   (void) this;
167   (void) _style;
168 }
169 
removeFromSpecialObjects(RenderBox * this)170 void removeFromSpecialObjects(RenderBox *this)
171 {
172   (void) this;
173 }
174 
RenderBox_isTableCell(RenderBox * this)175 bool RenderBox_isTableCell (RenderBox *this)
176 {
177   (void) this;
178   return false;
179 }
180 #endif
181 #endif
182 
183 void
testTortureExecute(void)184 testTortureExecute (void)
185 {
186 #ifndef __SDCC_pic16
187 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15)
188 #if !(defined (__GNUC__) && defined (__GNUC_MINOR__) && (__GNUC__ < 5))
189   g_this.m_relPositioned = false;
190   g_this.m_positioned = false;
191   g_this.m_floating = false;
192   g_this.isTableCell = RenderBox_isTableCell;
193 
194   g__style.noninherited_flags.f._position = FIXED;
195   g__style.noninherited_flags.f._floating = FNONE;
196 
197   RenderBox_setStyle (&g_this, &g__style);
198 
199   if (g_this.m_positioned != true)
200     ASSERT (0);
201   if (g_this.m_relPositioned != false)
202     ASSERT (0);
203   if (g_this.m_floating != false)
204     ASSERT (0);
205 
206   return;
207 #endif
208 #endif
209 #endif
210 }
211 
212