https://llvm.org/bugs/show_bug.cgi?id=25217
Bug ID: 25217
Summary: GlobalsAAResult possible dangling reference
Product: new-bugs
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
lib/Analysis/GlobalsModRef.cpp:491 sets FunctionInfo &FI as reference into the
DenseMap FunctionInfos.
FunctionInfo &FI = FunctionInfos[SCC[0]->getFunction()];
lib/Analysis/GlobalsModRef.cpp:590 copies FI into all FunctionInfo[SCC
members].
for (unsigned i = 1, e = SCC.size(); i != e; ++i)
FunctionInfos[SCC[i]->getFunction()] = FI;
DenseMap iterators are not stable and the loop could potentially invalidate the
reference FI, continuing using the invalidated reference.
Practically, that may be a rare case since 1) FunctionInfos may already have
all the required entries 2) DenseMap iterators are usually stable even when
inserting entry 3) The invalidate reference may still contain the right data.
The issue could be fixed by keeping a local copy of FI
FunctionInfo StackFI = FI;
for (unsigned i = 1, e = SCC.size(); i != e; ++i)
FunctionInfos[SCC[i]->getFunction()] = StackFI;
or not using the unstable reference FI while inserting entries
for (unsigned i = 1, e = SCC.size(); i != e; ++i)
FunctionInfos[SCC[i]->getFunction()] =
FunctionInfos[SCC[0]->getFunction()];
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs