aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ubsan/c99-shift-3.c
blob: ebb4f660ea9c0448a6752e6d86776836a4629c04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* { dg-do run } */
/* { dg-options "-fsanitize=shift-base -fno-sanitize=shift-exponent -w -std=c99" } */

int
main (void)
{
  int a = -42;
  int b = -43;
  volatile int c = 129;
  int d = 1;
  a << 1;
  b << c;
  a << 1;
  d <<= 31;
}
/* { dg-output "left shift of negative value -42\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*left shift of negative value -42\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*left shift of 1 by 31 places cannot be represented in type 'int'" } */