If we flow off the end of a value-returning function:
- outside C++, return undef (behavior is not undefined unless the value is used)
- in C++, with -fcatch-undefined-behavior, perform an appropriate trap
- in C++, produce an 'unreachable' (behavior is undefined immediately)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165273 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/catch-undef-behavior.c b/test/CodeGen/catch-undef-behavior.c
index 5832b6c..53dda5c 100644
--- a/test/CodeGen/catch-undef-behavior.c
+++ b/test/CodeGen/catch-undef-behavior.c
@@ -44,3 +44,11 @@
// CHECK-NEXT: ret i32 %[[RET]]
return a >> b;
}
+
+// CHECK: @no_return
+int no_return() {
+ // Reaching the end of a noreturn function is fine in C.
+ // CHECK-NOT: call
+ // CHECK-NOT: unreachable
+ // CHECK: ret i32
+}