summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-bitand-1.c
blob: f490b153b2d73c6ea5708de0ecf6d6eac9c8f0b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* { dg-do compile } */
/* { dg-options "-w -fdump-tree-original" } */

char c1 __attribute__ ((aligned (1)));
char c2 __attribute__ ((aligned (2)));
char c4 __attribute__ ((aligned (4)));
char c8 __attribute__ ((aligned (8))); 
unsigned f1(void)
{
  return 3 & (__SIZE_TYPE__)&c1;
}

unsigned f2(void)
{
  return 3 & (__SIZE_TYPE__)&c2;
}

unsigned f3(void)
{
  return 3 & (__SIZE_TYPE__)&c4;
}

unsigned f4(void)
{
  return 3 & (__SIZE_TYPE__)&c8;
}

/* { dg-final { scan-tree-dump-times "\&c1 \& 3" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "\&c2 \& 3" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "\&c4 \& 3" 0 "original" } } */
/* { dg-final { scan-tree-dump-times "\&c8 \& 3" 0 "original" } } */
/* { dg-final { scan-tree-dump-times "return 0" 2 "original" } } */
/* { dg-final { cleanup-tree-dump "original" } } */