diff options
author | Kaelyn Uhrain <rikka@google.com> | 2013-12-07 00:13:34 +0000 |
---|---|---|
committer | Kaelyn Uhrain <rikka@google.com> | 2013-12-07 00:13:34 +0000 |
commit | b95d0907fc6859b5f502a108e8793fa5335bf580 (patch) | |
tree | b26af9e38fe657bb17c16f42203fb8f0d29b46b6 /test | |
parent | 46af5e8efabfcd57b5872cda3eb10d92ca1780d4 (diff) | |
download | llvm-b95d0907fc6859b5f502a108e8793fa5335bf580.tar.gz llvm-b95d0907fc6859b5f502a108e8793fa5335bf580.tar.bz2 llvm-b95d0907fc6859b5f502a108e8793fa5335bf580.tar.xz |
Fix the segfault reported in PR 11990.
The sefault occurs due to an infinite loop when the verifier tries to
determine the size of a type of the form "%rt = type { %rt }" while
checking an alloca of the type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Verifier/recursive-type-1.ll | 12 | ||||
-rw-r--r-- | test/Verifier/recursive-type-2.ll | 14 | ||||
-rw-r--r-- | test/Verifier/recursive-type-3.ll | 11 |
3 files changed, 37 insertions, 0 deletions
diff --git a/test/Verifier/recursive-type-1.ll b/test/Verifier/recursive-type-1.ll new file mode 100644 index 0000000000..4a39957595 --- /dev/null +++ b/test/Verifier/recursive-type-1.ll @@ -0,0 +1,12 @@ +; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s + +%rt2 = type { i32, { i8, %rt2, i8 }, i32 } + +define i32 @main() nounwind { +entry: + ; Check that recursive types trigger an error instead of segfaulting, when + ; the recursion isn't through a pointer to the type. + ; CHECK: Cannot allocate unsized type + %0 = alloca %rt2 + ret i32 0 +} diff --git a/test/Verifier/recursive-type-2.ll b/test/Verifier/recursive-type-2.ll new file mode 100644 index 0000000000..5f2f66fa1b --- /dev/null +++ b/test/Verifier/recursive-type-2.ll @@ -0,0 +1,14 @@ +; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s + +%rt1 = type { i32, { i8, %rt2, i8 }, i32 } +%rt2 = type { i64, { i6, %rt3 } } +%rt3 = type { %rt1 } + +define i32 @main() nounwind { +entry: + ; Check that mutually recursive types trigger an error instead of segfaulting, + ; when the recursion isn't through a pointer to the type. + ; CHECK: Cannot allocate unsized type + %0 = alloca %rt2 + ret i32 0 +} diff --git a/test/Verifier/recursive-type-3.ll b/test/Verifier/recursive-type-3.ll new file mode 100644 index 0000000000..8968fb5eb6 --- /dev/null +++ b/test/Verifier/recursive-type-3.ll @@ -0,0 +1,11 @@ +; RUN: llvm-as %s -o /dev/null 2>&1 + +%rt2 = type { i32, { i8, %rt2*, i8 }, i32 } + +define i32 @main() nounwind { +entry: + ; Check that linked-list-style recursive types where the recursion is through + ; a pointer of the type is valid for an alloca. + %0 = alloca %rt2 + ret i32 0 +} |