From: Vikram S. Adve Date: Sun, 23 May 2004 07:34:53 +0000 (+0000) Subject: Fix size/offset assertion to allow negative offsets and folded nodes. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=44860ccaf2142ea87b2b3fcb7b193c07ede05927;p=oota-llvm.git Fix size/offset assertion to allow negative offsets and folded nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13644 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/DSNode.h b/include/llvm/Analysis/DSNode.h index 3ddd29a5ad0..f1bb90ed9c6 100644 --- a/include/llvm/Analysis/DSNode.h +++ b/include/llvm/Analysis/DSNode.h @@ -386,7 +386,14 @@ struct ilist_traits : public ilist_traits {}; // Define inline DSNodeHandle functions that depend on the definition of DSNode // inline DSNode *DSNodeHandle::getNode() const { - assert((!N || Offset < N->Size || (N->Size == 0 && Offset == 0) || + // Disabling this assertion because it is failing on a "magic" struct + // in named (from bind). The fourth field is an array of length 0, + // presumably used to create struct instances of different sizes. + assert((!N || + N->isNodeCompletelyFolded() || + (N->Size == 0 && Offset == 0) || + (int(Offset) >= 0 && Offset < N->Size) || + (int(Offset) < 0 && -int(Offset) < int(N->Size)) || N->isForwarding()) && "Node handle offset out of range!"); if (N == 0 || !N->isForwarding()) return N; diff --git a/include/llvm/Analysis/DataStructure/DSNode.h b/include/llvm/Analysis/DataStructure/DSNode.h index 3ddd29a5ad0..f1bb90ed9c6 100644 --- a/include/llvm/Analysis/DataStructure/DSNode.h +++ b/include/llvm/Analysis/DataStructure/DSNode.h @@ -386,7 +386,14 @@ struct ilist_traits : public ilist_traits {}; // Define inline DSNodeHandle functions that depend on the definition of DSNode // inline DSNode *DSNodeHandle::getNode() const { - assert((!N || Offset < N->Size || (N->Size == 0 && Offset == 0) || + // Disabling this assertion because it is failing on a "magic" struct + // in named (from bind). The fourth field is an array of length 0, + // presumably used to create struct instances of different sizes. + assert((!N || + N->isNodeCompletelyFolded() || + (N->Size == 0 && Offset == 0) || + (int(Offset) >= 0 && Offset < N->Size) || + (int(Offset) < 0 && -int(Offset) < int(N->Size)) || N->isForwarding()) && "Node handle offset out of range!"); if (N == 0 || !N->isForwarding()) return N;