Extract the load/store type verification to a separate function.
[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-array-element-type.bc 2>&1 | \
103 RUN:   FileCheck --check-prefix=ELEMENT-TYPE %s
104 RUN: not llvm-dis -disable-output %p/Inputs/invalid-vector-element-type.bc 2>&1 | \
105 RUN:   FileCheck --check-prefix=ELEMENT-TYPE %s
106 RUN: not llvm-dis -disable-output %p/Inputs/invalid-pointer-element-type.bc 2>&1 | \
107 RUN:   FileCheck --check-prefix=ELEMENT-TYPE %s
108
109 ELEMENT-TYPE: Invalid type
110
111 RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-op-not-2nd-to-last.bc 2>&1 | \
112 RUN:   FileCheck --check-prefix=ARRAY-NOT-2LAST %s
113
114 ARRAY-NOT-2LAST: Array op not second to last
115
116 RUN: not llvm-dis -disable-output %p/Inputs/invalid-too-big-fwdref.bc 2>&1 | \
117 RUN:   FileCheck --check-prefix=HUGE-FWDREF %s
118
119 HUGE-FWDREF: Invalid record
120
121 RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-pointer-type.bc 2>&1 | \
122 RUN:   FileCheck --check-prefix=LOAD-BAD-TYPE %s
123
124 LOAD-BAD-TYPE: Load/Store operand is not a pointer type
125
126 RUN: not llvm-dis -disable-output %p/Inputs/invalid-GCTable-overflow.bc 2>&1 | \
127 RUN:   FileCheck --check-prefix=GCTABLE-OFLOW %s
128
129 GCTABLE-OFLOW: Invalid ID
130
131 RUN: not llvm-dis -disable-output %p/Inputs/invalid-insert-0-indices.bc 2>&1 | \
132 RUN:   FileCheck --check-prefix=INSERT-0-IDXS %s
133
134 INSERT-0-IDXS: INSERTVAL: Invalid instruction with 0 indices
135
136 RUN: not llvm-dis -disable-output %p/Inputs/invalid-extract-0-indices.bc 2>&1 | \
137 RUN:   FileCheck --check-prefix=EXTRACT-0-IDXS %s
138
139 EXTRACT-0-IDXS: EXTRACTVAL: Invalid instruction with 0 indices
140
141 RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-ptr-type.bc 2>&1 | \
142 RUN:   FileCheck --check-prefix=BAD-LOAD-PTR-TYPE %s
143
144 BAD-LOAD-PTR-TYPE: Cannot load/store from pointer