summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/new-array-init.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-08-28 16:48:44 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-08-28 16:48:44 +0000
commit33375375a4c31cf31803c6f9555ca023864818fe (patch)
treef8e4e3072f6693adc5dce78cf2a499134ecb2bd8 /clang/test/CodeGenCXX/new-array-init.cpp
parent50cbfc513827b192b77f3c2ee5ea70fcda36433e (diff)
downloadbcm5719-llvm-33375375a4c31cf31803c6f9555ca023864818fe.tar.gz
bcm5719-llvm-33375375a4c31cf31803c6f9555ca023864818fe.zip
Throw a std::bad_array_new_length exception when the expression (or constant-expression) passed to operator new[] results in overflow in conformance with [expr.new]p7. Fixes PR11644.
llvm-svn: 216675
Diffstat (limited to 'clang/test/CodeGenCXX/new-array-init.cpp')
-rw-r--r--clang/test/CodeGenCXX/new-array-init.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/test/CodeGenCXX/new-array-init.cpp b/clang/test/CodeGenCXX/new-array-init.cpp
index 65123ea7fee..da11710bdd5 100644
--- a/clang/test/CodeGenCXX/new-array-init.cpp
+++ b/clang/test/CodeGenCXX/new-array-init.cpp
@@ -14,7 +14,12 @@ void fn(int n) {
// CHECK-LABEL: define void @_Z15const_underflowv
void const_underflow() {
// CHECK-NOT: icmp ult i{{32|64}} %{{[^ ]+}}, 3
- // CHECK: call noalias i8* @_Zna{{.}}(i{{32|64}} -1)
+ // CHECK: br label %[[BAD:.*]]
+ // CHECK: [[BAD]]:
+ // CHECK-NEXT: call void @__cxa_bad_array_new_length()
+ // CHECK-NEXT: unreachable
+ // CHECK: {{.*}}:
+ // CHECK: ret void
new int[2] { 1, 2, 3 };
}
OpenPOWER on IntegriCloud