[LLVMdev] Possible bug in DFAPacketizer::ReadTable
Carlos Sánchez de La Lama
csanchezdll at gmail.com
Mon Dec 10 02:48:24 PST 2012
Hi all,
I have found what I think it is a bug in DFAPacketizer::ReadTable.
When finding NextStateInTable to cache all transitions belonging to a state
into CachedTable, ReadTable does not check bounds:
unsigned ThisState =
DFAStateEntryTable[state];
|
unsigned NextStateInTable = DFAStateEntryTable[state+1];
which makes NextStateInTable get a random value when state == <last state
in table>. Behaviour changes depending on gcc version / platform / ..., but
in some cases might lead to segmentation faults.
I have checked the problem happens in Hexagon tests (for example fadd.ll
test) but does not break badly there (though CachedTable will get some
unneded and random data rows).
Probably making tblgen add an end-of-table marker in
<Target>DFAStateEntryTable is the easiest solution.
BR
Carlos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121210/3f120f7e/attachment.html>
More information about the llvm-dev
mailing list