diff options
Diffstat (limited to 'compiler-rt/lib/ubsan/lit_tests/Misc')
| -rw-r--r-- | compiler-rt/lib/ubsan/lit_tests/Misc/missing_return.cpp | 9 | ||||
| -rw-r--r-- | compiler-rt/lib/ubsan/lit_tests/Misc/unreachable.cpp | 6 |
2 files changed, 15 insertions, 0 deletions
diff --git a/compiler-rt/lib/ubsan/lit_tests/Misc/missing_return.cpp b/compiler-rt/lib/ubsan/lit_tests/Misc/missing_return.cpp new file mode 100644 index 00000000000..73febea4633 --- /dev/null +++ b/compiler-rt/lib/ubsan/lit_tests/Misc/missing_return.cpp @@ -0,0 +1,9 @@ +// RUN: %clang -fcatch-undefined-behavior %s -O3 -o %t && %t 2>&1 | FileCheck %s + +// CHECK: missing_return.cpp:4:5: fatal error: execution reached the end of a value-returning function without returning a value +int f() { +} + +int main(int, char **argv) { + return f(); +} diff --git a/compiler-rt/lib/ubsan/lit_tests/Misc/unreachable.cpp b/compiler-rt/lib/ubsan/lit_tests/Misc/unreachable.cpp new file mode 100644 index 00000000000..ded1de63aea --- /dev/null +++ b/compiler-rt/lib/ubsan/lit_tests/Misc/unreachable.cpp @@ -0,0 +1,6 @@ +// RUN: %clang -fcatch-undefined-behavior %s -O3 -o %t && %t 2>&1 | FileCheck %s + +int main(int, char **argv) { + // CHECK: unreachable.cpp:5:3: fatal error: execution reached a __builtin_unreachable() call + __builtin_unreachable(); +} |

