• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clangxx -fsanitize=bool %s -O3 -o %t
2 // RUN: not %run %t 2>&1 | FileCheck %s
3 // RUN: %env_ubsan_opts=print_summary=1:report_error_type=1 not %run %t 2>&1 | FileCheck %s --check-prefix=SUMMARY
4 
5 unsigned char NotABool = 123;
6 
main(int argc,char ** argv)7 int main(int argc, char **argv) {
8   bool *p = (bool*)&NotABool;
9 
10   // CHECK: bool.cpp:[[@LINE+1]]:10: runtime error: load of value 123, which is not a valid value for type 'bool'
11   return *p;
12   // SUMMARY: SUMMARY: {{.*}}Sanitizer: invalid-bool-load {{.*}}bool.cpp:[[@LINE-1]]
13 }
14