avoid undefined behaviour in fetch and modify of SP from 0a0e3cc51e
authorTony Cook <tony@develop-help.com>
Tue, 28 Dec 2010 02:58:29 +0000 (13:58 +1100)
committerTony Cook <tony@develop-help.com>
Tue, 28 Dec 2010 02:58:29 +0000 (13:58 +1100)
pp_sys.c: In function ‘Perl_pp_send’:
pp_sys.c:1845: warning: operation on ‘sp’ may be undefined

pp_sys.c

index 3f43e49..711f93a 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1842,7 +1842,8 @@ PP(pp_send)
        MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar);
        if (mg) {
            if (MARK == SP - 1) {
-               mXPUSHi(sv_len(*SP));
+               SV *sv = *SP;
+               mXPUSHi(sv_len(sv));
                PUTBACK;
            }