mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 08:56:07 +00:00

This is a recommit of r231150, reverted in r231409. Turns out that -fsanitize=shift-base check implementation only works if the shift exponent is valid, otherwise it contains undefined behavior itself. Make sure we check that exponent is valid before we proceed to check the base. Make sure that we actually report invalid values of base or exponent if -fsanitize=shift-base or -fsanitize=shift-exponent is specified, respectively. llvm-svn: 231711
10 lines
506 B
C++
10 lines
506 B
C++
// RUN: %clang_cc1 -std=c++11 -fsanitize=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,unreachable,return,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
|
|
|
|
bool GetOptionalBool(bool *value);
|
|
bool GetBool(bool default_value) {
|
|
// CHECK-LABEL: @_Z7GetBoolb
|
|
// CHECK-NOT: select
|
|
bool value;
|
|
return GetOptionalBool(&value) ? value : default_value;
|
|
}
|