comparison gen/arrays.cpp @ 425:944d43f3779f

Fix the static array cast size check.
author Christian Kamm <kamm incasoftware de>
date Tue, 29 Jul 2008 12:44:28 +0200
parents c8d98ccad0cc
children 76078c8ab5b9
comparison
equal deleted inserted replaced
424:c8d98ccad0cc 425:944d43f3779f
986 if (fromtype->ty == Tsarray) { 986 if (fromtype->ty == Tsarray) {
987 Logger::cout() << "uvalTy = " << *uval->getType() << '\n'; 987 Logger::cout() << "uvalTy = " << *uval->getType() << '\n';
988 assert(isaPointer(uval->getType())); 988 assert(isaPointer(uval->getType()));
989 const LLArrayType* arrty = isaArray(uval->getType()->getContainedType(0)); 989 const LLArrayType* arrty = isaArray(uval->getType()->getContainedType(0));
990 990
991 if(arrty->getNumElements() % totype->next->size() != 0) 991 if(arrty->getNumElements()*fromtype->next->size() % totype->next->size() != 0)
992 { 992 {
993 error(loc, "invalid cast from '%s' to '%s', the element sizes don't line up", fromtype->toChars(), totype->toChars()); 993 error(loc, "invalid cast from '%s' to '%s', the element sizes don't line up", fromtype->toChars(), totype->toChars());
994 fatal(); 994 fatal();
995 } 995 }
996 996