diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-07-19 23:24:41 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-07-19 23:24:41 +0000 |
commit | 4c6568869e8a362f544d1c7996fe7be2c738a64b (patch) | |
tree | a161568c57e85266303d1f01e863db82dab5db70 | |
parent | a3c78f59814f90a06994f720d75ecbae2612c4c3 (diff) | |
download | bcm5719-llvm-4c6568869e8a362f544d1c7996fe7be2c738a64b.tar.gz bcm5719-llvm-4c6568869e8a362f544d1c7996fe7be2c738a64b.zip |
Fix typo causing assert in self-host.
llvm-svn: 337508
-rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGen/init.c | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index afe2bfe8e9b..cfd0b859233 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -664,7 +664,7 @@ EmitArrayConstant(CodeGenModule &CGM, const ConstantArrayType *DestType, // struct of two arrays (the nonzero data and the zeroinitializer). if (CommonElementType && NonzeroLength >= 8) { llvm::Constant *Initial = llvm::ConstantArray::get( - llvm::ArrayType::get(CommonElementType, ArrayBound), + llvm::ArrayType::get(CommonElementType, NonzeroLength), makeArrayRef(Elements).take_front(NonzeroLength)); Elements.resize(2); Elements[0] = Initial; diff --git a/clang/test/CodeGen/init.c b/clang/test/CodeGen/init.c index 770995f93f3..0353ba8be12 100644 --- a/clang/test/CodeGen/init.c +++ b/clang/test/CodeGen/init.c @@ -86,6 +86,17 @@ const char large_array_with_zeroes[1000] = { 'a', 'b', 'c', 1, 2, 3, 'x', 'y', 'z', 'z', 'y', [20] = 'q' }; +char global; + +// CHECK-DAG: @large_array_with_zeroes_2 = global <{ [10 x i8*], [90 x i8*] }> <{ [10 x i8*] [i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* @global], [90 x i8*] zeroinitializer }> +const void *large_array_with_zeroes_2[100] = { + [9] = &global +}; +// CHECK-DAG: @large_array_with_zeroes_3 = global <{ [10 x i8*], [990 x i8*] }> <{ [10 x i8*] [i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* @global], [990 x i8*] zeroinitializer }> +const void *large_array_with_zeroes_3[1000] = { + [9] = &global +}; + // PR279 comment #3 char test8(int X) { char str[100000] = "abc"; // tail should be memset. |