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