Skip to content

newFOROP: fix crash when optimizing 2-var for over builtin::indexed #23429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: blead
Choose a base branch
from

Conversation

mauke
Copy link
Contributor

@mauke mauke commented Jul 11, 2025

OP_ENTERSUB isn't necessarily a LISTOP, apparently, so we can't just grab its op_last. Instead, copy/paste logic from elsewhere in op.c to find the cvop.

Also, avoid crashing on "fake" pad entries that represent lexical subs from outer scopes by climbing up the scope chain until we reach a real pad entry.

Fixes #23405.


  • This set of changes requires a perldelta entry, and it is included.

@mauke mauke requested a review from leonerd July 11, 2025 07:14
mauke added 2 commits July 12, 2025 23:34
OP_ENTERSUB isn't necessarily a LISTOP, apparently, so we can't just
grab its op_last. Instead, copy/paste logic from elsewhere in op.c to
find the cvop.

Also, avoid crashing on "fake" pad entries that represent lexical subs
from outer scopes by climbing up the scope chain until we reach a real
pad entry.

Fixes Perl#23405.
@mauke mauke force-pushed the fix-23405-segfault-for branch from f5e4805 to 1731242 Compare July 12, 2025 22:12
@jkeenan
Copy link
Contributor

jkeenan commented Jul 13, 2025

When I apply the changes in the two test files to blead, configure and build, then run the two test files, they FAIL with segfaults. When I then apply the code changes, the test files PASS. So from a TDD perspective, this p.r. is good. Someone else will have to look at the concept and the C-code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Perl 5.42 segfault during compilation
2 participants