aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/ubsan/opts-4.c
blob: dfe3e6b7a70e8d3f4ab8d73d33ba24c1271e3d78 (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
/* { dg-do compile } */
/* { dg-options "-fsanitize=undefined -fno-sanitize-recover=integer-divide-by-zero -fno-sanitize-recover=shift -fdump-tree-optimized" } */
/* { dg-skip-if "" { *-*-* } { "-flto -fno-fat-lto-objects" } } */
/* { dg-final { scan-tree-dump-times "__ubsan_handle_divrem_overflow_abort" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "__ubsan_handle_shift_out_of_bounds_abort" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "__ubsan_handle_type_mismatch_v1" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-not "__ubsan_handle_type_mismatch_v1_abort" "optimized" } } */

int
foo (int x, int y)
{
  return x / y;
}

int
bar (int x, int y)
{
  return x << y;
}

enum E { E0, E1, E2, E3 };

enum E
baz (enum E *x)
{
  return *x;
}