Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 1189b87114b9d300ea13976c5b5227fea0c6e1c7
      
https://github.com/Perl/perl5/commit/1189b87114b9d300ea13976c5b5227fea0c6e1c7
  Author: Richard Leach <[email protected]>
  Date:   2026-01-29 (Thu, 29 Jan 2026)

  Changed paths:
    M embed.fnc
    M op.c
    M proto.h
    M t/op/sub.t

  Log Message:
  -----------
  S_clear_special_blocks - allow caller to notice that cv has been freed

GH #16868: `use strict;END{{{{}}}}{END}END{e}` triggers an assertion failure:
```
perl​: op.c​:10342​: CV *Perl_newATTRSUB_x(I32, OP *, OP *, OP *, OP *,
_Bool)​: Assertion `!cv || evanescent || SvREFCNT((SV*)cv) != 0'
failed.
```

In the following block, `S_clear_special_blocks` frees `cv`, but doesn't signal
that it has done so to the caller. The caller continues to act as if `cv` had
not been freed.
```
        if (name) {
            if (PL_parser && PL_parser->error_count) {
                clear_special_blocks(name, gv, cv);
            }
```

This commit changes `S_clear_special_blocks` from a void function to
returning a CV*:
```
    return SvIS_FREED(cv) ? NULL : cv;
```
The caller now assigns the result of the call back to `cv`.

This causes the test case to croak:
```
Bareword "e" not allowed while "strict subs" in use at -e line 1.
Execution of -e aborted due to compilation errors.
```



To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to