OSDN Git Service

gcc/testsuite/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / fold-bitand-4.c
1 /* { dg-do compile } */
2 /* { dg-options "-fdump-tree-original" } */
3
4 typedef char char4[4] __attribute__ ((aligned (4)));
5 char4 c4[4] __attribute__ ((aligned (16)));
6
7 typedef char char16[16] __attribute__ ((aligned (16)));
8 char16 c16[4] __attribute__ ((aligned (4)));
9
10 int f1 (void)
11 {
12   /* 12 */
13   return 15 & (__SIZE_TYPE__)&c4[3];
14 }
15
16 int f2 (int i)
17 {
18   /* Indeterminate */
19   return 15 & (__SIZE_TYPE__)&c4[i];
20 }
21
22 int f3 (int i)
23 {
24   /* 0 */
25   return 3 & (__SIZE_TYPE__)&c4[i];
26 }
27
28 int f4 (int i)
29 {
30   /* Indeterminate */
31   return 7 & (__SIZE_TYPE__)&c16[i];
32 }
33
34 int f5 (int i)
35 {
36   /* 0 */
37   return 3 & (__SIZE_TYPE__)&c16[i];
38 }
39
40 /* { dg-final { scan-tree-dump-times "return 12" 1 "original" } } */
41 /* { dg-final { scan-tree-dump-times "\& 15" 1 "original" } } */
42 /* { dg-final { scan-tree-dump-times "return 0" 2 "original" } } */
43 /* { dg-final { scan-tree-dump-times "\& 7" 1 "original" } } */
44 /* { dg-final { cleanup-tree-dump "original" } } */