Skip to content

Commit 477c689

Browse files
paltherrbartschaefer
authored andcommitted
53732: avoid tail-call exec in always block
1 parent 5198c44 commit 477c689

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2025-10-26 Bart Schaefer <[email protected]>
2+
3+
* Philippe: 53732: avoid tail-call exec in always block
4+
15
2025-10-24 Oliver Kiddle <[email protected]>
26

37
* 54002: Src/parse.c: silence compiler warning for static function

Src/loop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ exectry(Estate state, int do_exec)
774774
contflag = 0;
775775

776776
state->pc = always;
777-
execlist(state, 1, do_exec);
777+
execlist(state, 1, 0);
778778

779779
if (try_errflag)
780780
errflag |= ERRFLAG_ERROR;

Test/A01grammar.ztst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,12 @@
720720
>always 1
721721
>try 2
722722

723+
() { { return 2 } always { return 3 } }
724+
2:Exit status of always block is ignored
725+
726+
() { ( { return 2 } always { ( return 3 ) } ) }
727+
2:Regression test for exit status of always block is ignored also in tailcalls
728+
723729
(
724730
mywrap() { echo BEGIN; true; echo END }
725731
mytest() { { exit 3 } always { mywrap }; print Exited before this }

0 commit comments

Comments
 (0)