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
8int f() __attribute__((noinline)) {
9// CHECK-STACKTRACE: #0 {{.*}}f{{.*}}missing_return.cpp:[[@LINE-1]]
10}
11
12int main(int, char **argv) {
13 return f();
14}
15

source code of compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp