Don't assert if materializing before seeing any function bodies
[oota-llvm.git] / test / Bitcode / invalid.test
1 RUN: not llvm-dis -disable-output %p/Inputs/invalid-pr20485.bc 2>&1 | \
2 RUN:   FileCheck --check-prefix=INVALID-ENCODING %s
3 RUN: not llvm-dis -disable-output %p/Inputs/invalid-abbrev.bc 2>&1 | \
4 RUN:   FileCheck --check-prefix=BAD-ABBREV %s
5 RUN: not llvm-dis -disable-output %p/Inputs/invalid-unexpected-eof.bc 2>&1 | \
6 RUN:   FileCheck --check-prefix=UNEXPECTED-EOF %s
7 RUN: not llvm-dis -disable-output %p/Inputs/invalid-bad-abbrev-number.bc 2>&1 | \
8 RUN:   FileCheck --check-prefix=BAD-ABBREV-NUMBER %s
9 RUN: not llvm-dis -disable-output %p/Inputs/invalid-type-table-forward-ref.bc 2>&1 | \
10 RUN:   FileCheck --check-prefix=BAD-TYPE-TABLE-FORWARD-REF %s
11 RUN: not llvm-dis -disable-output %p/Inputs/invalid-bitwidth.bc 2>&1 | \
12 RUN:   FileCheck --check-prefix=BAD-BITWIDTH %s
13 RUN: not llvm-dis -disable-output %p/Inputs/invalid-align.bc  2>&1 | \
14 RUN:   FileCheck --check-prefix=BAD-ALIGN %s
15 RUN: not llvm-dis -disable-output %p/Inputs/invalid-gep-mismatched-explicit-type.bc 2>&1 | \
16 RUN:   FileCheck --check-prefix=MISMATCHED-EXPLICIT-GEP %s
17 RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-mismatched-explicit-type.bc 2>&1 | \
18 RUN:   FileCheck --check-prefix=MISMATCHED-EXPLICIT-LOAD %s
19 RUN: not llvm-dis -disable-output %p/Inputs/invalid-gep-operator-mismatched-explicit-type.bc 2>&1 | \
20 RUN:   FileCheck --check-prefix=MISMATCHED-EXPLICIT-GEP-OPERATOR %s
21 RUN: not llvm-dis -disable-output %p/Inputs/invalid-call-mismatched-explicit-type.bc 2>&1 | \
22 RUN:   FileCheck --check-prefix=MISMATCHED-EXPLICIT-CALL %s
23 RUN: not llvm-dis -disable-output %p/Inputs/invalid-call-non-function-explicit-type.bc 2>&1 | \
24 RUN:   FileCheck --check-prefix=NON-FUNCTION-EXPLICIT-CALL %s
25 RUN: not llvm-dis -disable-output %p/Inputs/invalid-invoke-mismatched-explicit-type.bc 2>&1 | \
26 RUN:   FileCheck --check-prefix=MISMATCHED-EXPLICIT-INVOKE %s
27 RUN: not llvm-dis -disable-output %p/Inputs/invalid-invoke-non-function-explicit-type.bc 2>&1 | \
28 RUN:   FileCheck --check-prefix=NON-FUNCTION-EXPLICIT-INVOKE %s
29
30 INVALID-ENCODING: Invalid encoding
31 BAD-ABBREV: Abbreviation starts with an Array or a Blob
32 UNEXPECTED-EOF: Unexpected end of file
33 BAD-ABBREV-NUMBER: Invalid abbrev number
34 BAD-TYPE-TABLE-FORWARD-REF: Invalid TYPE table: Only named structs can be forward referenced
35 BAD-BITWIDTH: Bitwidth for integer type out of range
36 BAD-ALIGN: Invalid alignment value
37 MISMATCHED-EXPLICIT-GEP: Explicit gep type does not match pointee type of pointer operand
38 MISMATCHED-EXPLICIT-LOAD: Explicit load/store type does not match pointee type of pointer operand
39 MISMATCHED-EXPLICIT-GEP-OPERATOR: Explicit gep operator type does not match pointee type of pointer operand
40 MISMATCHED-EXPLICIT-CALL: Explicit call type does not match pointee type of callee operand
41 NON-FUNCTION-EXPLICIT-CALL: Explicit call type is not a function type
42 MISMATCHED-EXPLICIT-INVOKE: Explicit invoke type does not match pointee type of callee operand
43 NON-FUNCTION-EXPLICIT-INVOKE: Explicit invoke type is not a function type
44
45 RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-array-idx.bc 2>&1 | \
46 RUN:   FileCheck --check-prefix=EXTRACT-ARRAY %s
47 RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-struct-idx.bc 2>&1 | \
48 RUN:   FileCheck --check-prefix=EXTRACT-STRUCT %s
49 RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-too-many-idxs.bc 2>&1 | \
50 RUN:   FileCheck --check-prefix=EXTRACT-IDXS %s
51 RUN: not llvm-dis -disable-output %p/Inputs/invalid-insertval-array-idx.bc 2>&1 | \
52 RUN:   FileCheck --check-prefix=INSERT-ARRAY %s
53 RUN: not llvm-dis -disable-output %p/Inputs/invalid-insertval-struct-idx.bc 2>&1 | \
54 RUN:   FileCheck --check-prefix=INSERT-STRUCT %s
55 RUN: not llvm-dis -disable-output %p/Inputs/invalid-insertval-too-many-idxs.bc 2>&1 | \
56 RUN:   FileCheck --check-prefix=INSERT-IDXS %s
57
58
59 EXTRACT-ARRAY: EXTRACTVAL: Invalid array index
60 EXTRACT-STRUCT: EXTRACTVAL: Invalid struct index
61 EXTRACT-IDXS: EXTRACTVAL: Invalid type
62 INSERT-ARRAY: INSERTVAL: Invalid array index
63 INSERT-STRUCT: INSERTVAL: Invalid struct index
64 INSERT-IDXS: INSERTVAL: Invalid type
65
66 RUN: not llvm-dis -disable-output %p/Inputs/invalid-no-proper-module.bc 2>&1 | \
67 RUN:   FileCheck --check-prefix=NO-MODULE %s
68
69 NO-MODULE: Malformed IR file
70
71 RUN: not llvm-dis -disable-output %p/Inputs/invalid-fp-shift.bc 2>&1 | \
72 RUN:   FileCheck --check-prefix=FP-SHIFT %s
73
74 FP-SHIFT: Invalid record
75
76 RUN: not llvm-dis -disable-output %p/Inputs/invalid-abbrev-vbr-size-too-big.bc 2>&1 | \
77 RUN:   FileCheck --check-prefix=HUGE-ABBREV-OP %s
78 RUN: not llvm-dis -disable-output %p/Inputs/invalid-abbrev-fixed-size-too-big.bc 2>&1 | \
79 RUN:   FileCheck --check-prefix=HUGE-ABBREV-OP %s
80
81 HUGE-ABBREV-OP: Fixed or VBR abbrev record with size > MaxChunkData
82
83 RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-type.bc 2>&1 | \
84 RUN:   FileCheck --check-prefix=ARRAY-TYPE %s
85
86 ARRAY-TYPE: Array element type can't be an Array or a Blob
87
88 RUN: not llvm-dis -disable-output %p/Inputs/invalid-non-vector-extractelement.bc 2>&1 | \
89 RUN:   FileCheck --check-prefix=INVALID-TYPE %s
90 RUN: not llvm-dis -disable-output %p/Inputs/invalid-non-vector-insertelement.bc 2>&1 | \
91 RUN:   FileCheck --check-prefix=INVALID-TYPE %s
92 RUN: not llvm-dis -disable-output %p/Inputs/invalid-non-vector-shufflevector.bc 2>&1 | \
93 RUN:   FileCheck --check-prefix=INVALID-TYPE %s
94
95 INVALID-TYPE: Invalid type for value
96
97 RUN: not llvm-dis -disable-output %p/Inputs/invalid-fwdref-type-mismatch.bc 2>&1 | \
98 RUN:   FileCheck --check-prefix=FWDREF-TYPE %s
99
100 FWDREF-TYPE: Invalid record
101
102 RUN: not llvm-dis -disable-output %p/Inputs/invalid-fwdref-type-mismatch-2.bc 2>&1 | \
103 RUN:   FileCheck --check-prefix=FWDREF-TYPE-MISMATCH %s
104
105 FWDREF-TYPE-MISMATCH: Type mismatch in constant table!
106
107 RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-element-type.bc 2>&1 | \
108 RUN:   FileCheck --check-prefix=ELEMENT-TYPE %s
109 RUN: not llvm-dis -disable-output %p/Inputs/invalid-vector-element-type.bc 2>&1 | \
110 RUN:   FileCheck --check-prefix=ELEMENT-TYPE %s
111 RUN: not llvm-dis -disable-output %p/Inputs/invalid-pointer-element-type.bc 2>&1 | \
112 RUN:   FileCheck --check-prefix=ELEMENT-TYPE %s
113
114 ELEMENT-TYPE: Invalid type
115
116 RUN: not llvm-dis -disable-output %p/Inputs/invalid-cast.bc 2>&1 | \
117 RUN:   FileCheck --check-prefix=INVALID-CAST %s
118
119 INVALID-CAST: Invalid cast
120
121 RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-op-not-2nd-to-last.bc 2>&1 | \
122 RUN:   FileCheck --check-prefix=ARRAY-NOT-2LAST %s
123
124 ARRAY-NOT-2LAST: Array op not second to last
125
126 RUN: not llvm-dis -disable-output %p/Inputs/invalid-too-big-fwdref.bc 2>&1 | \
127 RUN:   FileCheck --check-prefix=HUGE-FWDREF %s
128
129 HUGE-FWDREF: Invalid record
130
131 RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-pointer-type.bc 2>&1 | \
132 RUN:   FileCheck --check-prefix=LOAD-BAD-TYPE %s
133
134 LOAD-BAD-TYPE: Load/Store operand is not a pointer type
135
136 RUN: not llvm-dis -disable-output %p/Inputs/invalid-GCTable-overflow.bc 2>&1 | \
137 RUN:   FileCheck --check-prefix=GCTABLE-OFLOW %s
138
139 GCTABLE-OFLOW: Invalid ID
140
141 RUN: not llvm-dis -disable-output %p/Inputs/invalid-insert-0-indices.bc 2>&1 | \
142 RUN:   FileCheck --check-prefix=INSERT-0-IDXS %s
143
144 INSERT-0-IDXS: INSERTVAL: Invalid instruction with 0 indices
145
146 RUN: not llvm-dis -disable-output %p/Inputs/invalid-extract-0-indices.bc 2>&1 | \
147 RUN:   FileCheck --check-prefix=EXTRACT-0-IDXS %s
148
149 EXTRACT-0-IDXS: EXTRACTVAL: Invalid instruction with 0 indices
150
151 RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-ptr-type.bc 2>&1 | \
152 RUN:   FileCheck --check-prefix=BAD-LOAD-PTR-TYPE %s
153
154 BAD-LOAD-PTR-TYPE: Cannot load/store from pointer
155
156 RUN: not llvm-dis -disable-output %p/Inputs/invalid-inserted-value-type-mismatch.bc 2>&1 | \
157 RUN:   FileCheck --check-prefix=INSERT-TYPE-MISMATCH %s
158
159 INSERT-TYPE-MISMATCH: Inserted value type doesn't match aggregate type
160
161 RUN: not llvm-dis -disable-output %p/Inputs/invalid-code-len-width.bc 2>&1 | \
162 RUN:   FileCheck --check-prefix=INVALID-CODELENWIDTH %s
163
164 INVALID-CODELENWIDTH: Malformed block
165
166 RUN: not llvm-dis -disable-output %p/Inputs/invalid-function-argument-type.bc 2>&1 | \
167 RUN:   FileCheck --check-prefix=INVALID-ARGUMENT-TYPE %s
168
169 INVALID-ARGUMENT-TYPE: Invalid function argument type
170
171 RUN: not llvm-dis -disable-output %p/Inputs/invalid-fixme-streaming-blob.bc 2>&1 | \
172 RUN:   FileCheck --check-prefix=STREAMING-BLOB %s
173
174 STREAMING-BLOB: getPointer in streaming memory objects not allowed
175
176 RUN: not llvm-dis -disable-output %p/Inputs/invalid-function-comdat-id.bc 2>&1 | \
177 RUN:   FileCheck --check-prefix=INVALID-FCOMDAT-ID %s
178
179 INVALID-FCOMDAT-ID: Invalid function comdat ID
180
181 RUN: not llvm-dis -disable-output %p/Inputs/invalid-global-var-comdat-id.bc 2>&1 | \
182 RUN:   FileCheck --check-prefix=INVALID-GVCOMDAT-ID %s
183
184 INVALID-GVCOMDAT-ID: Invalid global variable comdat ID
185
186 RUN: not llvm-dis -disable-output %p/Inputs/invalid-abbrev-no-operands.bc 2>&1 | \
187 RUN:   FileCheck --check-prefix=ABBREV-NO-OPS %s
188
189 ABBREV-NO-OPS: Abbrev record with no operands
190
191 RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-operand-encoding.bc 2>&1 | \
192 RUN:   FileCheck --check-prefix=ARRAY-OP-ENC %s
193
194 ARRAY-OP-ENC: Array element type has to be an encoding of a type
195
196 RUN: not llvm-dis -disable-output %p/Inputs/invalid-metadata-not-followed-named-node.bc 2>&1 | \
197 RUN:   FileCheck --check-prefix=META-NOT-FOLLOWED-BY-NAMED-META %s
198
199 META-NOT-FOLLOWED-BY-NAMED-META: METADATA_NAME not followed by METADATA_NAMED_NODE
200
201 RUN: not llvm-dis -disable-output %p/Inputs/invalid-vector-length.bc 2>&1 | \
202 RUN:   FileCheck --check-prefix=VECTOR-LENGTH %s
203
204 VECTOR-LENGTH: Invalid vector length
205
206 RUN: not llvm-dis -disable-output %p/Inputs/invalid-alias-type-mismatch.bc 2>&1 | \
207 RUN:   FileCheck --check-prefix=ALIAS-TYPE-MISMATCH %s
208
209 ALIAS-TYPE-MISMATCH: Alias and aliasee types don't match
210
211 RUN: not llvm-dis -disable-output %p/Inputs/invalid-no-function-block.bc 2>&1 | \
212 RUN:   FileCheck --check-prefix=NO-FUNCTION-BLOCK %s
213
214 NO-FUNCTION-BLOCK: Trying to materialize functions before seeing function blocks