mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-09 13:33:17 +00:00
Fix a crash that happens when mapping something like this:
{ short, short } to short where the second short maps onto the second field of the first struct. In this case, the struct index is not aligned, so we should avoid calling getLink(2), which asserts out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20626 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f23e3a2d38
commit
4d5af8e894
@ -2077,12 +2077,18 @@ void DSGraph::computeNodeMapping(const DSNodeHandle &NH1,
|
||||
unsigned N2Size = N2->getSize();
|
||||
if (N2Size == 0) return; // No edges to map to.
|
||||
|
||||
for (unsigned i = 0, e = N1->getSize(); i < e; i += DS::PointerSize)
|
||||
if (unsigned(N2Idx)+i < N2Size)
|
||||
computeNodeMapping(N1->getLink(i), N2->getLink(N2Idx+i), NodeMap);
|
||||
else
|
||||
computeNodeMapping(N1->getLink(i),
|
||||
N2->getLink(unsigned(N2Idx+i) % N2Size), NodeMap);
|
||||
for (unsigned i = 0, e = N1->getSize(); i < e; i += DS::PointerSize) {
|
||||
const DSNodeHandle &N1NH = N1->getLink(i);
|
||||
// Don't call N2->getLink if not needed (avoiding crash if N2Idx is not
|
||||
// aligned right).
|
||||
if (!N1NH.isNull()) {
|
||||
if (unsigned(N2Idx)+i < N2Size)
|
||||
computeNodeMapping(N1NH, N2->getLink(N2Idx+i), NodeMap);
|
||||
else
|
||||
computeNodeMapping(N1NH,
|
||||
N2->getLink(unsigned(N2Idx+i) % N2Size), NodeMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user