From 1be839e808a6ea1db8042d36b6b466c6fd77dcde Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Wed, 11 Nov 2015 05:40:52 +0100 Subject: [PATCH] magic pass: disable extra isArrayAsStructTy check The check caused the pass to crash on the new MIB service. Change-Id: Iad475d4e7368d17ebf6fee32f280b00bd874b780 --- minix/llvm/passes/magic/support/TypeUtil.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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) { -- 2.44.0