[llvm-bugs] [Bug 25217] New: GlobalsAAResult possible dangling reference
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Oct 16 12:31:49 PDT 2015
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: unassignedbugs at nondot.org
Reporter: yaron.keren at gmail.com
CC: chandlerc at gmail.com, llvm-bugs at lists.llvm.org
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151016/39d48941/attachment.html>
More information about the llvm-bugs
mailing list