llvm-for-llvmta/tools/clang/test/CodeGen/ubsan-conditional.c

11 lines
274 B
C
Raw Normal View History

2022-04-25 13:02:35 +02:00
// RUN: %clang_cc1 %s -emit-llvm -fsanitize=float-divide-by-zero -o - | FileCheck %s
_Bool b;
// CHECK: @f(
double f() {
// CHECK: %[[B:.*]] = load {{.*}} @b
// CHECK: %[[COND:.*]] = trunc {{.*}} %[[B]] to i1
// CHECK: br i1 %[[COND]]
return b ? 0.0 / 0.0 : 0.0;
}