[PATCH] Fix infinite recursion in MemoryBuiltins when examining cyclic instruction

Stephen Lin swlin at post.harvard.edu
Wed Oct 9 10:06:53 PDT 2013


Hi,

This patch is to resolve a crash (stack overflow) bug that was narrowed
down to infinitely recursive calls to
ObjectSizeOffsetEvaluator::visitGEPOperator and
ObjectSizeOffsetEvaluator::compute_ when visiting an unreachable but cyclic
instruction to the effect of:

    %cyclic = getelementptr inbounds i8* %cyclic, i64 0

I originally thought the issue was that the cycle was being formed at all,
but apparently cycle formation in unreachable code is something which is
known to be possible after certain transformations (this particular cycle
happens after PHI node simplification in an unreachable basic block
leftover from some other pass). ObjectSizeOffsetVisitor in same file has a
comment that the possibility of cycles is expected and bails out when
detecting, so I just modified the ObjectSizeOffsetEvaluator to do the same
thing.

This change is very small but I'm not very familiar with this particular
code, so if anyone with more expertise with it can take a look, please let
me know.

Thanks,
Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131009/c0d464ad/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: memory-builtins-cyclic-fix.patch
Type: application/octet-stream
Size: 1658 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131009/c0d464ad/attachment.obj>


More information about the llvm-commits mailing list