aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/ubsan/opts-3.c
blob: 7ec51478c5a549052fd52169948cafe9a9576f4b (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 compile } */
/* { dg-options "-fsanitize=undefined -fno-sanitize=shift -fno-sanitize=float-divide-by-zero -fdump-tree-optimized" } */
/* { dg-skip-if "" { *-*-* } { "-flto -fno-fat-lto-objects" } } */
/* { dg-final { scan-tree-dump-times "__ubsan_handle_divrem_overflow" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-not "__ubsan_handle_shift_out_of_bounds" "optimized" } } */

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

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

float
baz (float x, float y)
{
  return x / y;
}