diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2017-02-13 23:49:55 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2017-02-13 23:49:55 +0000 |
commit | 515451d31036344d4a58d8145eeb5795d0d3980a (patch) | |
tree | 11d3df608ab20fb97eef9c7fb7e4e62962a097b5 /test/CodeGenCXX/new-array-init.cpp | |
parent | 288e8b831e9a9ede7e1d68aa282489a7fae86154 (diff) |
When the new expr's array size is an ICE, emit it as a constant expression.
This bypasses integer sanitization checks which are redundant on the expression since it's been checked by Sema. Fixes a clang codegen assertion on "void test() { new int[0+1]{0}; }" when building with -fsanitize=signed-integer-overflow.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/new-array-init.cpp')
-rw-r--r-- | test/CodeGenCXX/new-array-init.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/CodeGenCXX/new-array-init.cpp b/test/CodeGenCXX/new-array-init.cpp index 0429ae770b..ccc218e2b2 100644 --- a/test/CodeGenCXX/new-array-init.cpp +++ b/test/CodeGenCXX/new-array-init.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple i386-unknown-unknown %s -emit-llvm -fsanitize=signed-integer-overflow -o - | FileCheck --check-prefix=SIO %s // CHECK: @[[ABC4:.*]] = {{.*}} constant [4 x i8] c"abc\00" // CHECK: @[[ABC15:.*]] = {{.*}} constant [15 x i8] c"abc\00\00\00\00 @@ -116,3 +117,9 @@ void aggr_sufficient(int n) { struct Aggr { int a, b; }; new Aggr[n] { 1, 2, 3 }; } + +// SIO-LABEL: define void @_Z14constexpr_testv +void constexpr_test() { + // SIO: call i8* @_Zna{{.}}(i32 4) + new int[0+1]{0}; +} |