diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-10-09 01:58:35 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-10-09 01:58:35 +0000 |
commit | 2fdb25b5a9c096f38bbd3f622c34ff9b2744e56d (patch) | |
tree | 84d2bdb36932ce7268181066797ef9a45781d308 /test/Transforms/SROA/basictest.ll | |
parent | 03753aa7598a0c313846fd49fc7eaf75c2d9f003 (diff) | |
download | external_llvm-2fdb25b5a9c096f38bbd3f622c34ff9b2744e56d.zip external_llvm-2fdb25b5a9c096f38bbd3f622c34ff9b2744e56d.tar.gz external_llvm-2fdb25b5a9c096f38bbd3f622c34ff9b2744e56d.tar.bz2 |
Fix PR14034, an infloop / heap corruption / crash bug in the new SROA.
Thanks to Benjamin for the raw test case. This one took about 50 times
longer to reduce than to fix. =/
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165476 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/SROA/basictest.ll')
-rw-r--r-- | test/Transforms/SROA/basictest.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Transforms/SROA/basictest.ll b/test/Transforms/SROA/basictest.ll index 3089736..e7767ef 100644 --- a/test/Transforms/SROA/basictest.ll +++ b/test/Transforms/SROA/basictest.ll @@ -948,3 +948,23 @@ entry: ret double %ret ; CHECK: ret double %x } + +%PR14034.struct = type { { {} }, i32, %PR14034.list } +%PR14034.list = type { %PR14034.list*, %PR14034.list* } + +define void @PR14034() { +; This test case tries to form GEPs into the empty leading struct members, and +; subsequently crashed (under valgrind) before we fixed the PR. The important +; thing is to handle empty structs gracefully. +; CHECK: @PR14034 + +entry: + %a = alloca %PR14034.struct + %list = getelementptr %PR14034.struct* %a, i32 0, i32 2 + %prev = getelementptr %PR14034.list* %list, i32 0, i32 1 + store %PR14034.list* undef, %PR14034.list** %prev + %cast0 = bitcast %PR14034.struct* undef to i8* + %cast1 = bitcast %PR14034.struct* %a to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %cast0, i8* %cast1, i32 12, i32 0, i1 false) + ret void +} |