Hack around over-optimized labels-as-values extension from GCC.

This commit is contained in:
gbeauche 2008-01-06 16:19:27 +00:00
parent e08bb16edf
commit a56e4b9be0

View File

@ -2394,13 +2394,25 @@ int main(void)
b_region = &&L_b_region1; b_region = &&L_b_region1;
e_region = &&L_e_region1; e_region = &&L_e_region1;
#endif #endif
/* This is a really awful hack but otherwise gcc is smart enough
* (or bug'ous enough?) to optimize the labels and place them
* e.g. at the "main" entry point, which is wrong.
*/
volatile int label_hack = 1;
switch (label_hack) {
case 1:
L_b_region1: L_b_region1:
page[REF_INDEX] = REF_VALUE; page[REF_INDEX] = REF_VALUE;
if (page[REF_INDEX] != REF_VALUE) if (page[REF_INDEX] != REF_VALUE)
exit(20); exit(20);
page[REF_INDEX] = REF_VALUE; page[REF_INDEX] = REF_VALUE;
BARRIER(); BARRIER();
// fall-through
case 2:
L_e_region1: L_e_region1:
BARRIER();
break;
}
if (handler_called != 1) if (handler_called != 1)
return 5; return 5;
@ -2431,6 +2443,8 @@ int main(void)
b_region = &&L_b_region2; b_region = &&L_b_region2;
e_region = &&L_e_region2; e_region = &&L_e_region2;
#endif #endif
switch (label_hack) {
case 1:
L_b_region2: L_b_region2:
TEST_SKIP_INSTRUCTION(unsigned char); TEST_SKIP_INSTRUCTION(unsigned char);
TEST_SKIP_INSTRUCTION(unsigned short); TEST_SKIP_INSTRUCTION(unsigned short);
@ -2441,8 +2455,12 @@ int main(void)
TEST_SKIP_INSTRUCTION(signed int); TEST_SKIP_INSTRUCTION(signed int);
TEST_SKIP_INSTRUCTION(signed long); TEST_SKIP_INSTRUCTION(signed long);
BARRIER(); BARRIER();
// fall-through
case 2:
L_e_region2: L_e_region2:
BARRIER();
break;
}
if (!arch_insn_skipper_tests()) if (!arch_insn_skipper_tests())
return 20; return 20;
#endif #endif