if (ValID >= ValueList.size()) {
AliasInits.push_back(AliasInitWorklist.back());
} else {
- if (Constant *C = dyn_cast_or_null<Constant>(ValueList[ValID]))
- AliasInitWorklist.back().first->setAliasee(C);
- else
+ if (Constant *C = dyn_cast_or_null<Constant>(ValueList[ValID])) {
+ GlobalAlias *Alias = AliasInitWorklist.back().first;
+ if (C->getType() != Alias->getType())
+ return Error("Alias and aliasee types don't match");
+ Alias->setAliasee(C);
+ } else
return Error("Expected a constant");
}
AliasInitWorklist.pop_back();
RUN: FileCheck --check-prefix=VECTOR-LENGTH %s
VECTOR-LENGTH: Invalid vector length
+
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-alias-type-mismatch.bc 2>&1 | \
+RUN: FileCheck --check-prefix=ALIAS-TYPE-MISMATCH %s
+
+ALIAS-TYPE-MISMATCH: Alias and aliasee types don't match