OSDN Git Service

2010-01-21 Martin Jambor <mjambor@suse.cz>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / 20020411-1.c
1 /* PR c/6223
2    This testcase ICEd in internal check because a constant was not truncated
3    for its mode.  */
4 /* { dg-do compile } */
5 /* { dg-options "-O2" } */
6 /* { dg-options "-O2 -march=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
7
8 #if __INT_MAX__ > 32767
9
10 typedef struct
11 {
12   unsigned a : 16;
13   unsigned b : 16;
14   unsigned c : 5;
15   unsigned d : 2;
16   unsigned e : 1;
17   unsigned f : 4;
18   unsigned g : 1;
19   unsigned h : 1;
20   unsigned i : 1;
21   unsigned j : 1;
22 } T;
23
24 inline void
25 foo (T *x, unsigned int y)
26 {
27   if ((x->j = (y >= 0x100000)))
28     y >>= 12;
29   x->a = y;
30   x->f = (y >> 16);
31 }
32
33 void __attribute__((noinline))
34 bar (T *x)
35 {
36 }
37
38 void
39 baz (unsigned int x, unsigned char y)
40 {
41   T t;
42
43   foo (&t, x - 1);
44   t.e = 1;
45   t.c = y;
46   t.g = 0;
47   t.h = 0;
48   t.i = (y & 0x40) != 0;
49   if (x == 1)
50     foo (&t, 1);
51   bar (&t);
52 }
53
54 #endif /* __INT_MAX__ */