xref: /llvm-project/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp (revision e6e4362901ae95b455366f907fb1145938808208)
1 // RUN: %clangxx -fsanitize=return %gmlt %s -O3 -o %t
2 // RUN: not %run %t 2>&1 | FileCheck %s
3 // RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-STACKTRACE
4 // Error message does not exact what expected
5 // XFAIL: target={{.*openbsd.*}}
6 
7 // CHECK: missing_return.cpp:[[@LINE+1]]:5: runtime error: execution reached the end of a value-returning function without returning a value
f()8 int f() __attribute__((noinline)) {
9 // CHECK-STACKTRACE: #0 {{.*}}f{{.*}}missing_return.cpp:[[@LINE-1]]
10 }
11 
main(int,char ** argv)12 int main(int, char **argv) {
13   return f();
14 }
15