summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr37261.c
blob: a05ada148c1f8ee252e56e472094eef69bae5be3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* PR c/37261 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

unsigned
foo (int x)
{
  unsigned a = ((x & 1) | 2) & 0x80000000;	/* { dg-bogus "integer overflow in expression" } */
  unsigned b = ((x & 2) | 2) & 0x80000000;	/* { dg-bogus "integer overflow in expression" } */
  unsigned c = ((x & 4) | 2) & 0x80000000;	/* { dg-bogus "integer overflow in expression" } */
  return a + b + c;
}

/* { dg-final { scan-tree-dump "return 0" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */