OSDN Git Service

PR middle-end/35456
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / bitfld-4.c
1 /* When comparisons of bit-fields to unsigned constants got shortened,
2    the shortened signed constant was wrongly marked as overflowing,
3    leading to a later integer_zerop failure and misoptimization.
4
5    Related to bug tree-optimization/16437 but shows the problem on
6    32-bit systems.  */
7 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
8
9 extern void abort (void);
10
11 struct s { int a:12, b:20; };
12
13 struct s x = { -123, -456 };
14
15 int
16 main (void)
17 {
18   if (x.a != -123U || x.b != -456U)
19     abort ();
20   return 0;
21 }