nayakgi / perl-compiler

Automatically exported from code.google.com/p/perl-compiler
Other
0 stars 0 forks source link

Attribute::Handlers crash in final LEAVE #304

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Code using Attribute::Handlers crashes in the final LEAVE_SCOPE(0) in LEAVE at 
S_run_body, 
when trying to cv_undef the Attribute::Handlers::INIT function.
There are 22 stack frames to be cleaned as left-over from compile-time 
Attribute::Handlers.

./pccAttribute_Handlers(Perl_cv_undef+0x2ed)[0x4f435d]
./pccAttribute_Handlers(Perl_sv_clear+0x6bc)[0x544f4c]
./pccAttribute_Handlers(Perl_sv_free2+0xdd)[0x54539d]
./pccAttribute_Handlers(Perl_leave_scope+0x63b)[0x567dab]
./pccAttribute_Handlers[0x4c6176]
./pccAttribute_Handlers(Perl_my_exit+0x23)[0x4caae3]
./pccAttribute_Handlers(perl_run+0x25c)[0x4cde5c]

See branch `my_perl_run` to use a less strict my_leave_scope.
For -O3 we can skip this at all.

We really only need my_leave_scope(0) at run_body:

-    /* my_exit(0); */
+    STATUS_ALL_SUCCESS;
-    /* my_exit_jump(); */
+    POPSTACK_TO(PL_mainstack);
+    dounwind(-1);
+    my_leave_scope(aTHX_ 0);
+    JMPENV_JUMP(2);

testcase t/testc.sh 169

Original issue reported on code.google.com by reini.urban on 20 Feb 2014 at 6:11

GoogleCodeExporter commented 9 years ago
Fixed with commit 9c3afc5ed6e33173cb6dba6c52a0511e1c7b7147
Author: Reini Urban <rurban@cpanel.net>
Date:   Thu Feb 20 13:45:04 2014 -0600

    C dynpadlist-518: new -fno-dyn-padlist to keep static padlists

    >=5.18 only. we rather play safe and use dynamic padlists to prevent
    from cv_undef crashes when cleaning up the stack on non-local exits, like
    die or exit.

Only crashes with 5.10 now

Original comment by reini.urban on 24 Feb 2014 at 3:16