summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/catch-undef-behavior.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-12-18 00:22:45 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-12-18 00:22:45 +0000
commitbe024a815053546cedf5c54c528426d8da8d2530 (patch)
tree9b5ce296a906c6fa1a75f1c271afab9ea68f61dc /clang/test/CodeGenCXX/catch-undef-behavior.cpp
parent43b1e13386741b4a321c1be19608c863de00f6e8 (diff)
downloadbcm5719-llvm-be024a815053546cedf5c54c528426d8da8d2530.tar.gz
bcm5719-llvm-be024a815053546cedf5c54c528426d8da8d2530.zip
Rein ubsan's vptr sanitizer back a bit. Per core issue 453, binding a reference
to an object outside its lifetime does not have undefined behavior. llvm-svn: 170387
Diffstat (limited to 'clang/test/CodeGenCXX/catch-undef-behavior.cpp')
-rw-r--r--clang/test/CodeGenCXX/catch-undef-behavior.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/clang/test/CodeGenCXX/catch-undef-behavior.cpp b/clang/test/CodeGenCXX/catch-undef-behavior.cpp
index a4e13bfa261..9fba80f268d 100644
--- a/clang/test/CodeGenCXX/catch-undef-behavior.cpp
+++ b/clang/test/CodeGenCXX/catch-undef-behavior.cpp
@@ -1,7 +1,13 @@
// RUN: %clang_cc1 -fsanitize=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift,unreachable,return,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
+struct S {
+ double d;
+ int a, b;
+ virtual int f();
+};
+
// CHECK: @_Z17reference_binding
-void reference_binding(int *p) {
+void reference_binding(int *p, S *q) {
// C++ core issue 453: If an lvalue to which a reference is directly bound
// designates neither an existing object or function of an appropriate type,
// nor a region of storage of suitable size and alignment to contain an object
@@ -16,13 +22,11 @@ void reference_binding(int *p) {
// CHECK-NEXT: %[[MISALIGN:.*]] = and i64 %[[PTRINT]], 3
// CHECK-NEXT: icmp eq i64 %[[MISALIGN]], 0
int &r = *p;
-}
-struct S {
- double d;
- int a, b;
- virtual int f();
-};
+ // A reference is not required to refer to an object within its lifetime.
+ // CHECK-NOT: __ubsan_handle_dynamic_type_cache_miss
+ S &r2 = *q;
+}
// CHECK: @_Z13member_access
void member_access(S *p) {
OpenPOWER on IntegriCloud