From: David van Moolenbroek Date: Wed, 11 Nov 2015 04:40:52 +0000 (+0100) Subject: magic pass: disable extra isArrayAsStructTy check X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/Bv9ARM.ch10.html?a=commitdiff_plain;h=1be839e808a6ea1db8042d36b6b466c6fd77dcde;p=minix.git magic pass: disable extra isArrayAsStructTy check The check caused the pass to crash on the new MIB service. Change-Id: Iad475d4e7368d17ebf6fee32f280b00bd874b780 --- diff --git a/minix/llvm/passes/magic/support/TypeUtil.cpp b/minix/llvm/passes/magic/support/TypeUtil.cpp index bab861ca6..a963c8c11 100644 --- a/minix/llvm/passes/magic/support/TypeUtil.cpp +++ b/minix/llvm/passes/magic/support/TypeUtil.cpp @@ -148,7 +148,22 @@ bool TypeUtil::isArrayAsStructTy(TYPECONST Type *type) { if(!type->isStructTy()) { return false; } - return type->getNumContainedTypes() == 1 || type->getContainedType(0) == type->getContainedType(1); + if (type->getNumContainedTypes() == 1) { + return true; + } + /* + * This check is no longer used, because it may wrongly fail in the case of + * an array of instances of a structure that contains a union that is + * initialized in different ways for array element 0 and 1. What we really + * need is a check to see whether the elements are *compatible*, but we do + * not appear to have the means to do that here. We warn if the check fails + * so as to make sure that its removal is not the source of new problems. + */ + if (type->getContainedType(0) != type->getContainedType(1)) { + TypeUtilLog("strict isArrayAsStructTy test failed"); + //return false; + } + return true; } unsigned TypeUtil::getHash(TYPECONST Type* type) {