1RUN: not llvm-dis -disable-output %p/Inputs/invalid-empty.bc 2>&1 | \
2RUN:   FileCheck --check-prefix=INVALID-EMPTY %s
3RUN: not --crash llvm-dis -disable-output %p/Inputs/invalid-pr20485.bc 2>&1 | \
4RUN:   FileCheck --check-prefix=INVALID-ENCODING %s
5RUN: not llvm-dis -disable-output %p/Inputs/invalid-abbrev.bc 2>&1 | \
6RUN:   FileCheck --check-prefix=BAD-ABBREV %s
7RUN: not llvm-dis -disable-output %p/Inputs/invalid-unexpected-eof.bc 2>&1 | \
8RUN:   FileCheck --check-prefix=UNEXPECTED-EOF %s
9RUN: not llvm-dis -disable-output %p/Inputs/invalid-bad-abbrev-number.bc 2>&1 | \
10RUN:   FileCheck --check-prefix=BAD-ABBREV-NUMBER %s
11RUN: not llvm-dis -disable-output %p/Inputs/invalid-type-table-forward-ref.bc 2>&1 | \
12RUN:   FileCheck --check-prefix=BAD-TYPE-TABLE-FORWARD-REF %s
13RUN: not llvm-dis -disable-output %p/Inputs/invalid-bitwidth.bc 2>&1 | \
14RUN:   FileCheck --check-prefix=BAD-BITWIDTH %s
15RUN: not llvm-dis -disable-output %p/Inputs/invalid-align.bc  2>&1 | \
16RUN:   FileCheck --check-prefix=BAD-ALIGN %s
17RUN: not llvm-dis -disable-output %p/Inputs/invalid-gep-mismatched-explicit-type.bc 2>&1 | \
18RUN:   FileCheck --check-prefix=MISMATCHED-EXPLICIT-GEP %s
19RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-mismatched-explicit-type.bc 2>&1 | \
20RUN:   FileCheck --check-prefix=MISMATCHED-EXPLICIT-LOAD %s
21RUN: not llvm-dis -disable-output %p/Inputs/invalid-gep-operator-mismatched-explicit-type.bc 2>&1 | \
22RUN:   FileCheck --check-prefix=MISMATCHED-EXPLICIT-GEP-OPERATOR %s
23RUN: not llvm-dis -disable-output %p/Inputs/invalid-call-mismatched-explicit-type.bc 2>&1 | \
24RUN:   FileCheck --check-prefix=MISMATCHED-EXPLICIT-CALL %s
25RUN: not llvm-dis -disable-output %p/Inputs/invalid-call-non-function-explicit-type.bc 2>&1 | \
26RUN:   FileCheck --check-prefix=NON-FUNCTION-EXPLICIT-CALL %s
27RUN: not llvm-dis -disable-output %p/Inputs/invalid-invoke-mismatched-explicit-type.bc 2>&1 | \
28RUN:   FileCheck --check-prefix=MISMATCHED-EXPLICIT-INVOKE %s
29RUN: not llvm-dis -disable-output %p/Inputs/invalid-invoke-non-function-explicit-type.bc 2>&1 | \
30RUN:   FileCheck --check-prefix=NON-FUNCTION-EXPLICIT-INVOKE %s
31
32INVALID-EMPTY: error: file too small to contain bitcode header
33INVALID-ENCODING: Invalid encoding
34BAD-ABBREV: error: can't skip to bit
35UNEXPECTED-EOF: error: can't skip to bit
36BAD-ABBREV-NUMBER: error: can't skip to bit
37BAD-TYPE-TABLE-FORWARD-REF: Invalid TYPE table: Only named structs can be forward referenced
38BAD-BITWIDTH: error: can't skip to bit
39BAD-ALIGN: Invalid alignment value
40MISMATCHED-EXPLICIT-GEP: Explicit gep type does not match pointee type of pointer operand
41MISMATCHED-EXPLICIT-LOAD: Explicit load/store type does not match pointee type of pointer operand
42MISMATCHED-EXPLICIT-GEP-OPERATOR: Explicit gep operator type does not match pointee type of pointer operand
43MISMATCHED-EXPLICIT-CALL: Explicit call type does not match pointee type of callee operand
44NON-FUNCTION-EXPLICIT-CALL: Explicit call type is not a function type
45MISMATCHED-EXPLICIT-INVOKE: Explicit invoke type does not match pointee type of callee operand
46NON-FUNCTION-EXPLICIT-INVOKE: Explicit invoke type is not a function type
47
48RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-array-idx.bc 2>&1 | \
49RUN:   FileCheck --check-prefix=EXTRACT-ARRAY %s
50RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-struct-idx.bc 2>&1 | \
51RUN:   FileCheck --check-prefix=EXTRACT-STRUCT %s
52RUN: not llvm-dis -disable-output %p/Inputs/invalid-extractval-too-many-idxs.bc 2>&1 | \
53RUN:   FileCheck --check-prefix=EXTRACT-IDXS %s
54RUN: not llvm-dis -disable-output %p/Inputs/invalid-insertval-array-idx.bc 2>&1 | \
55RUN:   FileCheck --check-prefix=INSERT-ARRAY %s
56RUN: not llvm-dis -disable-output %p/Inputs/invalid-insertval-struct-idx.bc 2>&1 | \
57RUN:   FileCheck --check-prefix=INSERT-STRUCT %s
58RUN: not llvm-dis -disable-output %p/Inputs/invalid-insertval-too-many-idxs.bc 2>&1 | \
59RUN:   FileCheck --check-prefix=INSERT-IDXS %s
60
61
62EXTRACT-ARRAY: EXTRACTVAL: Invalid array index
63EXTRACT-STRUCT: EXTRACTVAL: Invalid struct index
64EXTRACT-IDXS: EXTRACTVAL: Invalid type
65INSERT-ARRAY: INSERTVAL: Invalid array index
66INSERT-STRUCT: INSERTVAL: Invalid struct index
67INSERT-IDXS: INSERTVAL: Invalid type
68
69RUN: not llvm-dis -disable-output %p/Inputs/invalid-fp-shift.bc 2>&1 | \
70RUN:   FileCheck --check-prefix=FP-SHIFT %s
71
72FP-SHIFT: Invalid record
73
74RUN: not --crash llvm-dis -disable-output %p/Inputs/invalid-abbrev-vbr-size-too-big.bc 2>&1 | \
75RUN:   FileCheck --check-prefix=HUGE-ABBREV-OP %s
76RUN: not --crash llvm-dis -disable-output %p/Inputs/invalid-abbrev-fixed-size-too-big.bc 2>&1 | \
77RUN:   FileCheck --check-prefix=HUGE-ABBREV-OP %s
78
79HUGE-ABBREV-OP: Fixed or VBR abbrev record with size > MaxChunkData
80
81RUN: not --crash llvm-dis -disable-output %p/Inputs/invalid-array-type.bc 2>&1 | \
82RUN:   FileCheck --check-prefix=ARRAY-TYPE %s
83
84ARRAY-TYPE: Array element type can't be an Array or a Blob
85
86RUN: not llvm-dis -disable-output %p/Inputs/invalid-non-vector-extractelement.bc 2>&1 | \
87RUN:   FileCheck --check-prefix=INVALID-TYPE %s
88RUN: not llvm-dis -disable-output %p/Inputs/invalid-non-vector-insertelement.bc 2>&1 | \
89RUN:   FileCheck --check-prefix=INVALID-TYPE %s
90RUN: not llvm-dis -disable-output %p/Inputs/invalid-non-vector-shufflevector.bc 2>&1 | \
91RUN:   FileCheck --check-prefix=INVALID-TYPE %s
92
93INVALID-TYPE: Invalid type for value
94
95RUN: not llvm-dis -disable-output %p/Inputs/invalid-fwdref-type-mismatch.bc 2>&1 | \
96RUN:   FileCheck --check-prefix=FWDREF-TYPE %s
97
98FWDREF-TYPE: Invalid record
99
100RUN: not llvm-dis -disable-output %p/Inputs/invalid-fwdref-type-mismatch-2.bc 2>&1 | \
101RUN:   FileCheck --check-prefix=FWDREF-TYPE-MISMATCH %s
102
103FWDREF-TYPE-MISMATCH: Malformed block
104
105RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-element-type.bc 2>&1 | \
106RUN:   FileCheck --check-prefix=ELEMENT-TYPE %s
107RUN: not llvm-dis -disable-output %p/Inputs/invalid-vector-element-type.bc 2>&1 | \
108RUN:   FileCheck --check-prefix=ELEMENT-TYPE %s
109RUN: not llvm-dis -disable-output %p/Inputs/invalid-pointer-element-type.bc 2>&1 | \
110RUN:   FileCheck --check-prefix=ELEMENT-TYPE %s
111
112ELEMENT-TYPE: Invalid type
113
114RUN: not llvm-dis -disable-output %p/Inputs/invalid-cast.bc 2>&1 | \
115RUN:   FileCheck --check-prefix=INVALID-CAST %s
116
117INVALID-CAST: Invalid cast
118
119RUN: not --crash llvm-dis -disable-output %p/Inputs/invalid-array-op-not-2nd-to-last.bc 2>&1 | \
120RUN:   FileCheck --check-prefix=ARRAY-NOT-2LAST %s
121
122ARRAY-NOT-2LAST: Array op not second to last
123
124RUN: not llvm-dis -disable-output %p/Inputs/invalid-too-big-fwdref.bc 2>&1 | \
125RUN:   FileCheck --check-prefix=HUGE-FWDREF %s
126
127HUGE-FWDREF: Invalid record
128
129RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-pointer-type.bc 2>&1 | \
130RUN:   FileCheck --check-prefix=LOAD-BAD-TYPE %s
131
132LOAD-BAD-TYPE: Load operand is not a pointer type
133
134RUN: not llvm-dis -disable-output %p/Inputs/invalid-GCTable-overflow.bc 2>&1 | \
135RUN:   FileCheck --check-prefix=GCTABLE-OFLOW %s
136
137GCTABLE-OFLOW: Invalid ID
138
139RUN: not llvm-dis -disable-output %p/Inputs/invalid-insert-0-indices.bc 2>&1 | \
140RUN:   FileCheck --check-prefix=INSERT-0-IDXS %s
141
142INSERT-0-IDXS: INSERTVAL: Invalid instruction with 0 indices
143
144RUN: not llvm-dis -disable-output %p/Inputs/invalid-extract-0-indices.bc 2>&1 | \
145RUN:   FileCheck --check-prefix=EXTRACT-0-IDXS %s
146
147EXTRACT-0-IDXS: EXTRACTVAL: Invalid instruction with 0 indices
148
149RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-ptr-type.bc 2>&1 | \
150RUN:   FileCheck --check-prefix=BAD-LOAD-PTR-TYPE %s
151
152BAD-LOAD-PTR-TYPE: error: can't skip to bit
153
154RUN: not llvm-dis -disable-output %p/Inputs/invalid-inserted-value-type-mismatch.bc 2>&1 | \
155RUN:   FileCheck --check-prefix=INSERT-TYPE-MISMATCH %s
156
157INSERT-TYPE-MISMATCH: Inserted value type doesn't match aggregate type
158
159RUN: not llvm-dis -disable-output %p/Inputs/invalid-code-len-width.bc 2>&1 | \
160RUN:   FileCheck --check-prefix=INVALID-CODELENWIDTH %s
161
162INVALID-CODELENWIDTH: error: can't skip to bit
163
164RUN: not llvm-dis -disable-output %p/Inputs/invalid-function-argument-type.bc 2>&1 | \
165RUN:   FileCheck --check-prefix=INVALID-ARGUMENT-TYPE %s
166
167INVALID-ARGUMENT-TYPE: Invalid function argument type
168
169RUN: not llvm-dis -disable-output %p/Inputs/invalid-function-comdat-id.bc 2>&1 | \
170RUN:   FileCheck --check-prefix=INVALID-FCOMDAT-ID %s
171
172INVALID-FCOMDAT-ID: Malformed block
173
174RUN: not llvm-dis -disable-output %p/Inputs/invalid-global-var-comdat-id.bc 2>&1 | \
175RUN:   FileCheck --check-prefix=INVALID-GVCOMDAT-ID %s
176
177INVALID-GVCOMDAT-ID: Invalid global variable comdat ID
178
179RUN: not --crash llvm-dis -disable-output %p/Inputs/invalid-abbrev-no-operands.bc 2>&1 | \
180RUN:   FileCheck --check-prefix=ABBREV-NO-OPS %s
181
182ABBREV-NO-OPS: Abbrev record with no operands
183
184RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-operand-encoding.bc 2>&1 | \
185RUN:   FileCheck --check-prefix=ARRAY-OP-ENC %s
186
187ARRAY-OP-ENC: Malformed block
188
189RUN: not llvm-dis -disable-output %p/Inputs/invalid-metadata-not-followed-named-node.bc 2>&1 | \
190RUN:   FileCheck --check-prefix=META-NOT-FOLLOWED-BY-NAMED-META %s
191
192META-NOT-FOLLOWED-BY-NAMED-META: Malformed block
193
194RUN: not llvm-dis -disable-output %p/Inputs/invalid-vector-length.bc 2>&1 | \
195RUN:   FileCheck --check-prefix=VECTOR-LENGTH %s
196
197VECTOR-LENGTH: Invalid vector length
198
199RUN: not llvm-dis -disable-output %p/Inputs/invalid-alias-type-mismatch.bc 2>&1 | \
200RUN:   FileCheck --check-prefix=ALIAS-TYPE-MISMATCH %s
201
202ALIAS-TYPE-MISMATCH: Alias and aliasee types don't match
203
204RUN: not llvm-dis -disable-output %p/Inputs/invalid-no-function-block.bc 2>&1 | \
205RUN:   FileCheck --check-prefix=NO-FUNCTION-BLOCK %s
206
207NO-FUNCTION-BLOCK: Trying to materialize functions before seeing function blocks (Producer: 'LLVM3.8.0git' Reader: 'LLVM
208
209RUN: not llvm-dis -disable-output %p/Inputs/invalid-name-with-0-byte.bc 2>&1 | \
210RUN:   FileCheck --check-prefix=NAME-WITH-0 %s
211
212NAME-WITH-0: Malformed block
213
214RUN: not llvm-dis -disable-output %p/Inputs/invalid-void-constant.bc 2>&1 | \
215RUN:   FileCheck --check-prefix=VOID-CONSTANT-TYPE %s
216
217VOID-CONSTANT-TYPE: Invalid constant type
218
219RUN: not llvm-dis -disable-output %p/Inputs/invalid-gep-no-operands.bc 2>&1 | \
220RUN:   FileCheck --check-prefix=GEP-NO-OPERANDS %s
221
222GEP-NO-OPERANDS: Invalid gep with no operands
223
224RUN: not llvm-dis -disable-output %p/Inputs/invalid-nonpointer-storeatomic.bc 2>&1 | \
225RUN:   FileCheck --check-prefix=NONPOINTER-STOREATOMIC %s
226
227NONPOINTER-STOREATOMIC: Invalid record
228
229RUN: not llvm-dis -disable-output %p/Inputs/invalid-nonpointer-atomicrmw.bc 2>&1 | \
230RUN:   FileCheck --check-prefix=NONPOINTER-ATOMICRMW %s
231
232NONPOINTER-ATOMICRMW: Invalid record
233
234RUN: not llvm-dis -disable-output %p/Inputs/invalid-fcmp-opnum.bc 2>&1 | \
235RUN:   FileCheck --check-prefix=INVALID-FCMP-OPNUM %s
236
237INVALID-FCMP-OPNUM: Invalid record: operand number exceeded available operands
238
239RUN: not llvm-dis -disable-output %p/Inputs/invalid-cmpxchg-ordering.bc 2>&1 | \
240RUN:   FileCheck --check-prefix=CMPXCHG-ORDERING %s
241RUN: not llvm-dis -disable-output %p/Inputs/invalid-cmpxchg-ordering-2.bc 2>&1 | \
242RUN:   FileCheck --check-prefix=CMPXCHG-ORDERING %s
243RUN: not llvm-dis -disable-output %p/Inputs/invalid-cmpxchg-ordering-3.bc 2>&1 | \
244RUN:   FileCheck --check-prefix=CMPXCHG-ORDERING %s
245RUN: not llvm-dis -disable-output %p/Inputs/invalid-cmpxchg-ordering-4.bc 2>&1 | \
246RUN:   FileCheck --check-prefix=CMPXCHG-ORDERING %s
247
248CMPXCHG-ORDERING: Invalid cmpxchg {{failure|success}} ordering
249