[PATCH] D41719: [InlineCost] Prevent infinite recursion on function pointers

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 07:50:26 PST 2018


On Wed, Jan 3, 2018 at 3:36 PM, Eli Friedman via Phabricator via
llvm-commits <llvm-commits at lists.llvm.org> wrote:
> efriedma added a comment.
>
> The bug that's getting triggered by the testcase is that CallAnalyzer::analyzeCall is recursive, without any recursion limit, so it crashes by overflowing the stack.
>
> Your patch doesn't solve that issue in general; it only solves the problem for your specific testcase.  You could trigger a similar crash with a program that isn't recursive.  Or there might be some other way to trick CallAnalyzer into following a recursive program.  If you want to actually fix the bug, the solution is to either add a recursion depth limit, or make the algorithm iterative and add an iteration limit.
>
>

Replying here as HN took down Phabricator. I agree with Eli this is
the correct solution. I have a mild preference for moving the
algorithm to be iterative, FWIW.

Thanks,

--
Davide


More information about the llvm-commits mailing list