blob: 05e049e82ea9a6390e2f1b012e67f7095cdeba31 (
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
|
/* { dg-do compile } */
/* { dg-options "-fsanitize=shift -w" } */
/* { dg-shouldfail "ubsan" } */
int
foo (int x)
{
/* None of the following should pass. */
switch (x)
{
case 1 >> -1: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
case -1 >> -1: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
case 1 << -1: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
case -1 << -1: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
return 1;
}
return 0;
}
int
bar (int x)
{
/* None of the following should pass. */
switch (x)
{
case -1 >> 200: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
case 1 << 200: /* { dg-error "is not a constant expression" "" { xfail { *-*-* } } } */
return 1;
}
return 0;
}
|