Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Deep recursion error from function that isn't even recursive #409

Open
tobyink opened this issue Mar 7, 2020 · 3 comments
Open

Deep recursion error from function that isn't even recursive #409

tobyink opened this issue Mar 7, 2020 · 3 comments
Assignees
Labels

Comments

@tobyink
Copy link
Contributor

tobyink commented Mar 7, 2020

I get this failure in the Type-Tiny 1.010000 test suite:

Deep recursion on subroutine "Test::TypeTiny::should_fail" at t/20-unit/Types-Common-Numeric/ranges.t line 44.

But should_fail isn't a recursive function. It does do a goto \&Test::More::ok at the end after setting @_ so this could be a problem with cperl's tail call optimizations?

@tobyink
Copy link
Contributor Author

tobyink commented Mar 7, 2020

Oooh, additional information. should_fail is called all over the test suite, so I was curious why it was only this particular call that was dying.

Line 44 performs the 100th call of should_fail for ranges.t. The recursion limit is 100. So I guess it's thinking that these calls are recursive when they're really just repeated.

@tobyink
Copy link
Contributor Author

tobyink commented Mar 7, 2020

I can reproduce with this:

use strict;
use warnings FATAL => 'all';
use Test::More;

sub bar { goto \&Test::More::ok }

bar(1) for 1..101;

done_testing();

@tobyink
Copy link
Contributor Author

tobyink commented Mar 7, 2020

Further, Test::More::ok has a signature on cperl, though http://perl11.org/cperl/#Changed-calls-to-signatures seems to suggest that using goto would be the correct way to do a tail call to it.

@rurban rurban self-assigned this Mar 7, 2020
@rurban rurban added the bug label Mar 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants