summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-bitand-3.c
blob: 43d765bbf2e7f6ae247f68b745ca86bf0d4dc372 (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
/* { dg-do compile } */
/* { dg-options "-fdump-tree-original" } */

char c[4] __attribute__ ((aligned (4)));

struct S {
  char c1;
  char c2;
  char c3;
  char c4;
};

int f1 (void)
{
  return 3 & (__SIZE_TYPE__)&c[1];
}

int f2 (void)
{
  return 3 & (__SIZE_TYPE__)&((struct S *)&c)->c2;
}

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