summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/ubsan/lit_tests/Misc/bool.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-12-13 07:12:20 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-12-13 07:12:20 +0000
commit177f80376dc12a263372d5e5e526af2a8249ea2a (patch)
treed987f10563d9cbc880ce874e008813e8c73c6293 /compiler-rt/lib/ubsan/lit_tests/Misc/bool.cpp
parent1629da95fe78ae4cf8b66496aaddbe06bbbe2a90 (diff)
downloadbcm5719-llvm-177f80376dc12a263372d5e5e526af2a8249ea2a.tar.gz
bcm5719-llvm-177f80376dc12a263372d5e5e526af2a8249ea2a.zip
ubsan unit tests for -fsanitize=bool and -fsanitize=enum.
llvm-svn: 170109
Diffstat (limited to 'compiler-rt/lib/ubsan/lit_tests/Misc/bool.cpp')
-rw-r--r--compiler-rt/lib/ubsan/lit_tests/Misc/bool.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler-rt/lib/ubsan/lit_tests/Misc/bool.cpp b/compiler-rt/lib/ubsan/lit_tests/Misc/bool.cpp
new file mode 100644
index 00000000000..4df1fb82a5d
--- /dev/null
+++ b/compiler-rt/lib/ubsan/lit_tests/Misc/bool.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang -fsanitize=bool %s -O3 -o %t && %t 2>&1 | FileCheck %s
+
+unsigned char NotABool = 123;
+
+int main(int argc, char **argv) {
+ bool *p = (bool*)&NotABool;
+
+ // CHECK: error: load of value 123, which is not a valid value for type 'bool'
+ return *p;
+}
OpenPOWER on IntegriCloud