Skip to content

Commit 3bec23f

Browse files
committed
don't use Perl_suspend_compcv as destructor directly
SAVEDESTRUCTOR_X needs a function whose type is 'void (pTHX_ void *)' exactly, so introduce a little shim. Should fix this ASan error: scope.c:1543:13: runtime error: call to function Perl_suspend_compcv through pointer to incorrect function type 'void (*)(struct interpreter *, void *)'
1 parent d7e7549 commit 3bec23f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pad.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2963,6 +2963,12 @@ Perl_suspend_compcv(pTHX_ struct suspended_compcv *buffer)
29632963
buffer->pad_reset_pending = PL_pad_reset_pending;
29642964
}
29652965

2966+
/* interface compatible with SAVEDESTRUCTOR_X */
2967+
static void
2968+
S_suspend_compcv_destruct(pTHX_ void *p) {
2969+
suspend_compcv((struct suspended_compcv *)p);
2970+
}
2971+
29662972
/*
29672973
=for apidoc resume_compcv_final
29682974
@@ -3001,7 +3007,7 @@ Perl_resume_compcv(pTHX_ struct suspended_compcv *buffer, bool save)
30013007
SAVEBOOL(PL_pad_reset_pending); PL_pad_reset_pending = buffer->pad_reset_pending;
30023008

30033009
if(save)
3004-
SAVEDESTRUCTOR_X(&Perl_suspend_compcv, buffer);
3010+
SAVEDESTRUCTOR_X(S_suspend_compcv_destruct, buffer);
30053011
}
30063012

30073013
/*

0 commit comments

Comments
 (0)