aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/shift-2.c
blob: aaaeb6fcc0904abcaa5a3ea66b3ca8f14e67301c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* { dg-do run } */
/* { dg-options "-fsanitize=shift -w" } */

int
main (void)
{
  int a = 1;
  volatile int b = -5;
  long long int c = -6;

  a << -3;
  1 << -4;
  1 << b;
  a << c;
  a << (b + c);

  return 0;
}
/* { dg-output "shift exponent -3 is negative(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*shift exponent -4 is negative(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*shift exponent -5 is negative(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*shift exponent -6 is negative(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*shift exponent -11 is negative" } */