Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr19005.c
blob93f1d029f21a8a4a92dee6dc8856e7dad0497635
1 /*
2 pr19005.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* PR target/19005 */
13 int v, s;
15 void
16 bar (int a, int b)
18 unsigned char x = v;
20 if (!s)
22 if (a != x || b != (unsigned char) (x + 1))
23 ASSERT (0);
25 else if (a != (unsigned char) (x + 1) || b != x)
26 ASSERT (0);
27 s ^= 1;
30 int
31 foo (int x)
33 unsigned char a = x, b = x + 1;
35 bar (a, b);
36 a ^= b; b ^= a; a ^= b;
37 bar (a, b);
38 return 0;
41 void
42 testTortureExecute (void)
44 for (v = -10; v < 266; v++)
45 foo (v);
46 return;