* gcc.dg/stack-check-5.c: Skip with -fstack-protector.
[official-gcc.git] / gcc / testsuite / gcc.dg / pr11864-1.c
blobb8d7134193d17323c74bf4d5be99508a20936bd1
1 /* PR optimization/11864
2 * Reporter: Kazumoto Kojima <kkojima@gcc.gnu.org>
3 * Summary: [3.3/3.4 regression] miscompiles zero extension and test
4 * Description:
5 * gcc-3.3/3.4 -O2 for sh target may miscompile the combination of zero extension
6 * and test if it's zero.
8 * Testcase tweaked by dank@kegel.com. Not marked as xfail because it's a regression.
9 */
10 /* { dg-do run } */
11 /* { dg-options "-O2" } */
13 extern void abort(void);
15 int val = 0xff00;
17 int f(void)
19 return val;
22 unsigned char a[1];
24 void foo(void)
26 a[0] = f() & 255;
28 if (!a[0])
29 a[0] = f() & 255;
31 if (!a[0])
32 a[0] = 1 + (f() & 127);
35 int main(int argc, char **argv)
37 foo();
38 if (!a[0])
39 abort();
41 return 0;