1 RUN: export LSAN_OPTIONS=detect_leaks=0
2 RUN: not llvm-dis -disable-output %p/Inputs/invalid-empty.bc 2>&1 | \
3 RUN: FileCheck --check-prefix=INVALID-EMPTY %s
4 RUN: not llvm-dis -disable-output %p/Inputs/invalid-pr20485.bc 2>&1 | \
5 RUN: FileCheck --check-prefix=INVALID-ENCODING %s
6 RUN: not llvm-dis -disable-output %p/Inputs/invalid-abbrev.bc 2>&1 | \
7 RUN: FileCheck --check-prefix=BAD-ABBREV %s
8 RUN: not llvm-dis -disable-output %p/Inputs/invalid-unexpected-eof.bc 2>&1 | \
9 RUN: FileCheck --check-prefix=UNEXPECTED-EOF %s
10 RUN: not llvm-dis -disable-output %p/Inputs/invalid-bad-abbrev-number.bc 2>&1 | \
11 RUN: FileCheck --check-prefix=BAD-ABBREV-NUMBER %s
12 RUN: not llvm-dis -disable-output %p/Inputs/invalid-type-table-forward-ref.bc 2>&1 | \
13 RUN: FileCheck --check-prefix=BAD-TYPE-TABLE-FORWARD-REF %s
14 RUN: not llvm-dis -disable-output %p/Inputs/invalid-bitwidth.bc 2>&1 | \
15 RUN: FileCheck --check-prefix=BAD-BITWIDTH %s
16 RUN: not llvm-dis -disable-output %p/Inputs/invalid-align.bc 2>&1 | \
17 RUN: FileCheck --check-prefix=BAD-ALIGN %s
18 RUN: not llvm-dis -disable-output %p/Inputs/invalid-call-non-function-explicit-type.bc 2>&1 | \
19 RUN: FileCheck --check-prefix=NON-FUNCTION-EXPLICIT-CALL %s
20 RUN: not llvm-dis -disable-output %p/Inputs/invalid-invoke-mismatched-explicit-type.bc 2>&1 | \
21 RUN: FileCheck --check-prefix=MISMATCHED-EXPLICIT-INVOKE %s
22 RUN: not llvm-dis -disable-output %p/Inputs/invalid-invoke-non-function-explicit-type.bc 2>&1 | \
23 RUN: FileCheck --check-prefix=NON-FUNCTION-EXPLICIT-INVOKE %s
25 INVALID-EMPTY: error: file too small to contain bitcode header
26 INVALID-ENCODING: Invalid encoding
27 BAD-ABBREV: error: can't skip to bit
28 UNEXPECTED-EOF: error: can't skip to bit
29 BAD-ABBREV-NUMBER: error: can't skip to bit
30 BAD-TYPE-TABLE-FORWARD-REF: Invalid TYPE table: Only named structs can be forward referenced
31 BAD-BITWIDTH: error: can't skip to bit
32 BAD-ALIGN: Invalid alignment value
33 NON-FUNCTION-EXPLICIT-CALL: Explicit call type is not a function type
34 MISMATCHED-EXPLICIT-INVOKE: Insufficient operands to call
35 NON-FUNCTION-EXPLICIT-INVOKE: Explicit invoke type is not a function type
37 RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-array-idx.bc 2>&1 | \
38 RUN: FileCheck --check-prefix=EXTRACT-ARRAY %s
39 RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-struct-idx.bc 2>&1 | \
40 RUN: FileCheck --check-prefix=EXTRACT-STRUCT %s
41 RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-too-many-idxs.bc 2>&1 | \
42 RUN: FileCheck --check-prefix=EXTRACT-IDXS %s
43 RUN: not llvm-dis -disable-output %p/Inputs/invalid-insertval-array-idx.bc 2>&1 | \
44 RUN: FileCheck --check-prefix=INSERT-ARRAY %s
45 RUN: not llvm-dis -disable-output %p/Inputs/invalid-insertval-struct-idx.bc 2>&1 | \
46 RUN: FileCheck --check-prefix=INSERT-STRUCT %s
47 RUN: not llvm-dis -disable-output %p/Inputs/invalid-insertval-too-many-idxs.bc 2>&1 | \
48 RUN: FileCheck --check-prefix=INSERT-IDXS %s
51 EXTRACT-ARRAY: EXTRACTVAL: Invalid array index
52 EXTRACT-STRUCT: EXTRACTVAL: Invalid struct index
53 EXTRACT-IDXS: EXTRACTVAL: Invalid type
54 INSERT-ARRAY: INSERTVAL: Invalid array index
55 INSERT-STRUCT: INSERTVAL: Invalid struct index
56 INSERT-IDXS: INSERTVAL: Invalid type
58 RUN: not llvm-dis -disable-output %p/Inputs/invalid-fp-shift.bc 2>&1 | \
59 RUN: FileCheck --check-prefix=FP-SHIFT %s
61 FP-SHIFT: Invalid record
63 RUN: not llvm-dis -disable-output %p/Inputs/invalid-abbrev-vbr-size-too-big.bc 2>&1 | \
64 RUN: FileCheck --check-prefix=HUGE-ABBREV-OP %s
65 RUN: not llvm-dis -disable-output %p/Inputs/invalid-abbrev-fixed-size-too-big.bc 2>&1 | \
66 RUN: FileCheck --check-prefix=HUGE-ABBREV-OP %s
68 HUGE-ABBREV-OP: Fixed or VBR abbrev record with size > MaxChunkData
70 RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-type.bc 2>&1 | \
71 RUN: FileCheck --check-prefix=ARRAY-TYPE %s
73 ARRAY-TYPE: Array element type can't be an Array or a Blob
75 RUN: not llvm-dis -disable-output %p/Inputs/invalid-non-vector-extractelement.bc 2>&1 | \
76 RUN: FileCheck --check-prefix=INVALID-TYPE %s
77 RUN: not llvm-dis -disable-output %p/Inputs/invalid-non-vector-insertelement.bc 2>&1 | \
78 RUN: FileCheck --check-prefix=INVALID-TYPE %s
79 RUN: not llvm-dis -disable-output %p/Inputs/invalid-non-vector-shufflevector.bc 2>&1 | \
80 RUN: FileCheck --check-prefix=INVALID-TYPE %s
82 INVALID-TYPE: Invalid type for value
84 RUN: not llvm-dis -disable-output %p/Inputs/invalid-fwdref-type-mismatch.bc 2>&1 | \
85 RUN: FileCheck --check-prefix=FWDREF-TYPE %s
87 FWDREF-TYPE: Invalid record
89 RUN: not llvm-dis -disable-output %p/Inputs/invalid-fwdref-type-mismatch-2.bc 2>&1 | \
90 RUN: FileCheck --check-prefix=FWDREF-TYPE-MISMATCH %s
92 FWDREF-TYPE-MISMATCH: Malformed block
94 RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-element-type.bc 2>&1 | \
95 RUN: FileCheck --check-prefix=ELEMENT-TYPE %s
96 RUN: not llvm-dis -disable-output %p/Inputs/invalid-vector-element-type.bc 2>&1 | \
97 RUN: FileCheck --check-prefix=ELEMENT-TYPE %s
98 RUN: not llvm-dis -disable-output %p/Inputs/invalid-pointer-element-type.bc 2>&1 | \
99 RUN: FileCheck --check-prefix=ELEMENT-TYPE %s
101 ELEMENT-TYPE: Invalid type
103 RUN: not llvm-dis -disable-output %p/Inputs/invalid-cast.bc 2>&1 | \
104 RUN: FileCheck --check-prefix=INVALID-CAST %s
106 INVALID-CAST: Invalid cast
108 RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-op-not-2nd-to-last.bc 2>&1 | \
109 RUN: FileCheck --check-prefix=ARRAY-NOT-2LAST %s
111 ARRAY-NOT-2LAST: Array op not second to last
113 RUN: not llvm-dis -disable-output %p/Inputs/invalid-too-big-fwdref.bc 2>&1 | \
114 RUN: FileCheck --check-prefix=HUGE-FWDREF %s
116 HUGE-FWDREF: Invalid record
118 RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-pointer-type.bc 2>&1 | \
119 RUN: FileCheck --check-prefix=LOAD-BAD-TYPE %s
121 LOAD-BAD-TYPE: Load operand is not a pointer type
123 RUN: not llvm-dis -disable-output %p/Inputs/invalid-GCTable-overflow.bc 2>&1 | \
124 RUN: FileCheck --check-prefix=GCTABLE-OFLOW %s
126 GCTABLE-OFLOW: Invalid ID
128 RUN: not llvm-dis -disable-output %p/Inputs/invalid-insert-0-indices.bc 2>&1 | \
129 RUN: FileCheck --check-prefix=INSERT-0-IDXS %s
131 INSERT-0-IDXS: INSERTVAL: Invalid instruction with 0 indices
133 RUN: not llvm-dis -disable-output %p/Inputs/invalid-extract-0-indices.bc 2>&1 | \
134 RUN: FileCheck --check-prefix=EXTRACT-0-IDXS %s
136 EXTRACT-0-IDXS: EXTRACTVAL: Invalid instruction with 0 indices
138 RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-ptr-type.bc 2>&1 | \
139 RUN: FileCheck --check-prefix=BAD-LOAD-PTR-TYPE %s
141 BAD-LOAD-PTR-TYPE: error: can't skip to bit
143 RUN: not llvm-dis -disable-output %p/Inputs/invalid-inserted-value-type-mismatch.bc 2>&1 | \
144 RUN: FileCheck --check-prefix=INSERT-TYPE-MISMATCH %s
146 INSERT-TYPE-MISMATCH: Inserted value type doesn't match aggregate type
148 RUN: not llvm-dis -disable-output %p/Inputs/invalid-code-len-width.bc 2>&1 | \
149 RUN: FileCheck --check-prefix=INVALID-CODELENWIDTH %s
151 INVALID-CODELENWIDTH: error: can't skip to bit
153 RUN: not llvm-dis -disable-output %p/Inputs/invalid-function-argument-type.bc 2>&1 | \
154 RUN: FileCheck --check-prefix=INVALID-ARGUMENT-TYPE %s
156 INVALID-ARGUMENT-TYPE: Invalid function argument type
158 RUN: not llvm-dis -disable-output %p/Inputs/invalid-function-comdat-id.bc 2>&1 | \
159 RUN: FileCheck --check-prefix=INVALID-FCOMDAT-ID %s
161 INVALID-FCOMDAT-ID: Malformed block
163 RUN: not llvm-dis -disable-output %p/Inputs/invalid-global-var-comdat-id.bc 2>&1 | \
164 RUN: FileCheck --check-prefix=INVALID-GVCOMDAT-ID %s
166 INVALID-GVCOMDAT-ID: Invalid global variable comdat ID
168 RUN: not llvm-dis -disable-output %p/Inputs/invalid-abbrev-no-operands.bc 2>&1 | \
169 RUN: FileCheck --check-prefix=ABBREV-NO-OPS %s
171 ABBREV-NO-OPS: Abbrev record with no operands
173 RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-operand-encoding.bc 2>&1 | \
174 RUN: FileCheck --check-prefix=ARRAY-OP-ENC %s
176 ARRAY-OP-ENC: Malformed block
178 RUN: not llvm-dis -disable-output %p/Inputs/invalid-metadata-not-followed-named-node.bc 2>&1 | \
179 RUN: FileCheck --check-prefix=META-NOT-FOLLOWED-BY-NAMED-META %s
181 META-NOT-FOLLOWED-BY-NAMED-META: Malformed block
183 RUN: not llvm-dis -disable-output %p/Inputs/invalid-vector-length.bc 2>&1 | \
184 RUN: FileCheck --check-prefix=VECTOR-LENGTH %s
186 VECTOR-LENGTH: Invalid vector length
188 RUN: not llvm-dis -disable-output %p/Inputs/invalid-alias-type-mismatch.bc 2>&1 | \
189 RUN: FileCheck --check-prefix=ALIAS-TYPE-MISMATCH %s
191 ALIAS-TYPE-MISMATCH: Insufficient function protos
193 RUN: not llvm-dis -disable-output %p/Inputs/invalid-no-function-block.bc 2>&1 | \
194 RUN: FileCheck --check-prefix=NO-FUNCTION-BLOCK %s
196 NO-FUNCTION-BLOCK: Trying to materialize functions before seeing function blocks (Producer: 'LLVM3.8.0git' Reader: 'LLVM
198 RUN: not llvm-dis -disable-output %p/Inputs/invalid-name-with-0-byte.bc 2>&1 | \
199 RUN: FileCheck --check-prefix=NAME-WITH-0 %s
201 NAME-WITH-0: Malformed block
203 RUN: not llvm-dis -disable-output %p/Inputs/invalid-void-constant.bc 2>&1 | \
204 RUN: FileCheck --check-prefix=VOID-CONSTANT-TYPE %s
206 VOID-CONSTANT-TYPE: Invalid constant type
208 RUN: not llvm-dis -disable-output %p/Inputs/invalid-gep-no-operands.bc 2>&1 | \
209 RUN: FileCheck --check-prefix=GEP-NO-OPERANDS %s
211 GEP-NO-OPERANDS: Constant GEP record must have at least two elements
213 RUN: not llvm-dis -disable-output %p/Inputs/invalid-constant-gep.bc 2>&1 | \
214 RUN: FileCheck --check-prefix=INVALID-CONSTANT-GEP %s
216 INVALID-CONSTANT-GEP: Constant GEP record must have at least two elements
218 RUN: not llvm-dis -disable-output %p/Inputs/invalid-nonpointer-storeatomic.bc 2>&1 | \
219 RUN: FileCheck --check-prefix=NONPOINTER-STOREATOMIC %s
221 NONPOINTER-STOREATOMIC: Invalid record
223 RUN: not llvm-dis -disable-output %p/Inputs/invalid-nonpointer-atomicrmw.bc 2>&1 | \
224 RUN: FileCheck --check-prefix=NONPOINTER-ATOMICRMW %s
226 NONPOINTER-ATOMICRMW: Invalid record
228 RUN: not llvm-dis -disable-output %p/Inputs/invalid-fcmp-opnum.bc 2>&1 | \
229 RUN: FileCheck --check-prefix=INVALID-FCMP-OPNUM %s
231 INVALID-FCMP-OPNUM: Invalid record: operand number exceeded available operands
233 RUN: not llvm-dis -disable-output %p/Inputs/invalid-cmpxchg-ordering.bc 2>&1 | \
234 RUN: FileCheck --check-prefix=CMPXCHG-ORDERING %s
235 RUN: not llvm-dis -disable-output %p/Inputs/invalid-cmpxchg-ordering-2.bc 2>&1 | \
236 RUN: FileCheck --check-prefix=CMPXCHG-ORDERING %s
237 RUN: not llvm-dis -disable-output %p/Inputs/invalid-cmpxchg-ordering-3.bc 2>&1 | \
238 RUN: FileCheck --check-prefix=CMPXCHG-ORDERING %s
239 RUN: not llvm-dis -disable-output %p/Inputs/invalid-cmpxchg-ordering-4.bc 2>&1 | \
240 RUN: FileCheck --check-prefix=CMPXCHG-ORDERING %s
242 CMPXCHG-ORDERING: Invalid cmpxchg {{failure|success}} ordering
244 RUN: not llvm-dis -disable-output %p/Inputs/invalid-abbrev-number.bc 2>&1 | \
245 RUN: FileCheck --check-prefix=INVALID-ABBREV-NUMBER %s
247 INVALID-ABBREV-NUMBER: Invalid abbrev number
249 RUN: not llvm-dis -disable-output %p/Inputs/invalid-attribute-group-entry.bc 2>&1 | \
250 RUN: FileCheck --check-prefix=INVALID-ATTRIBUTE-GROUP-ENTRY %s
252 INVALID-ATTRIBUTE-GROUP-ENTRY: Invalid attribute group entry
254 RUN: not llvm-dis -disable-output %p/Inputs/unterminated-blob.bc 2>&1 | \
255 RUN: FileCheck --check-prefix=UNTERMINATED-BLOB %s
257 UNTERMINATED-BLOB: Blob ends too soon
259 RUN: not llvm-dis -disable-output %p/Inputs/invalid-value-symbol-table.bc 2>&1 | \
260 RUN: FileCheck --check-prefix=INVALID-VALUE-SYMBOL-TABLE %s
262 INVALID-VALUE-SYMBOL-TABLE: Invalid value reference in symbol table
264 RUN: not llvm-dis -disable-output %p/Inputs/unterminated-vbr.bc 2>&1 | \
265 RUN: FileCheck --check-prefix=UNTERMINATED-VBR %s
267 UNTERMINATED-VBR: Failed to read size: Unterminated VBR
269 RUN: not llvm-dis -disable-output %p/Inputs/comdat-name-too-large.bc 2>&1 | \
270 RUN: FileCheck --check-prefix=COMDAT-NAME-TOO-LARGE %s
272 COMDAT-NAME-TOO-LARGE: Comdat name size too large
274 RUN: not llvm-dis -disable-output %p/Inputs/invalid-chunk-size.bc 2>&1 | \
275 RUN: FileCheck --check-prefix=INVALID-CHUNK-SIZE %s
277 INVALID-CHUNK-SIZE: Fixed or VBR abbrev record with size > MaxChunkData
279 RUN: not llvm-dis -disable-output %p/Inputs/invalid-diimportedentity-record.bc 2>&1 | \
280 RUN: FileCheck --check-prefix=INVALID-DIIMPORTEDENTITY-RECORD %s
282 INVALID-DIIMPORTEDENTITY-RECORD: Invalid DIImportedEntity record
284 RUN: not llvm-dis -disable-output %p/Inputs/invalid-forward-declare.bc 2>&1 | \
285 RUN: FileCheck --check-prefix=INVALID-FORWARD-DECLARE %s
287 INVALID-FORWARD-DECLARE: Assigned value does not match type of forward declaration