diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-15 02:50:59 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-15 02:50:59 +0000 |
commit | 9ec1e48b59db3708b861e96058c73a6a8a51f488 (patch) | |
tree | d11ab73b68cb8f7c936107dec50155aa5a08093b /clang/test/CodeGenCXX/static-init.cpp | |
parent | d07ba6208fed3cfc69b04a5e0caa7f185f10b995 (diff) | |
download | bcm5719-llvm-9ec1e48b59db3708b861e96058c73a6a8a51f488.tar.gz bcm5719-llvm-9ec1e48b59db3708b861e96058c73a6a8a51f488.zip |
PR12226: don't generate wrong code if a braced string literal is used to
initialize an array of unsigned char. Outside C++11 mode, this bug was benign,
and just resulted in us emitting a constant which was double the required
length, padded with 0s. In C++11, it resulted in us generating an array whose
first element was something like i8 ptrtoint ([n x i8]* @str to i8).
llvm-svn: 154756
Diffstat (limited to 'clang/test/CodeGenCXX/static-init.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/static-init.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/static-init.cpp b/clang/test/CodeGenCXX/static-init.cpp index ed659de5e06..74278f7128c 100644 --- a/clang/test/CodeGenCXX/static-init.cpp +++ b/clang/test/CodeGenCXX/static-init.cpp @@ -2,6 +2,7 @@ // CHECK: @_ZZ1hvE1i = internal global i32 0, align 4 // CHECK: @base_req = global [4 x i8] c"foo\00", align 1 +// CHECK: @base_req_uchar = global [4 x i8] c"bar\00", align 1 // CHECK: @_ZZN5test31BC1EvE1u = internal global { i8, [3 x i8] } { i8 97, [3 x i8] undef }, align 4 // CHECK: @_ZZN5test1L6getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 16 @@ -64,6 +65,7 @@ namespace test1 { // Make sure we emit the initializer correctly for the following: char base_req[] = { "foo" }; +unsigned char base_req_uchar[] = { "bar" }; namespace union_static_local { // CHECK: define internal void @_ZZN18union_static_local4testEvEN1c4mainEv |