[perl #36470] 'undef $@; die' gives uninint value warning
authorDave Mitchell <davem@fdisolutions.com>
Wed, 6 Jul 2005 20:09:29 +0000 (20:09 +0000)
committerDave Mitchell <davem@fdisolutions.com>
Wed, 6 Jul 2005 20:09:29 +0000 (20:09 +0000)
p4raw-id: //depot/perl@25087

pp_sys.c
t/op/die.t

index 8cffb14..d05c547 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -517,7 +517,10 @@ PP(pp_die)
            if (SvPOK(error) && SvCUR(error))
                sv_catpv(error, "\t...propagated");
            tmpsv = error;
-           tmps = SvPV_const(tmpsv, len);
+           if (SvOK(tmpsv))
+               tmps = SvPV_const(tmpsv, len);
+           else
+               tmps = Nullch;
        }
     }
     if (!tmps || !len)
index 6f62afb..a51333f 100755 (executable)
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..14\n";
+print "1..15\n";
 
 $SIG{__DIE__} = sub { print ref($_[0]) ? ("ok ",$_[0]->[0]++,"\n") : @_ } ;
 
@@ -61,3 +61,14 @@ print "ok 10\n";
     print "not " unless $@ =~ /Global symbol "\$\x{3b1}"/;
     print "ok 14\n";
 }
+
+# [perl #36470] got uninit warning if $@ was undef
+
+{
+    my $ok = 1;
+    local $SIG{__DIE__};
+    local $SIG{__WARN__} = sub { $ok = 0 };
+    eval { undef $@; die };
+    print "not " unless $ok;
+    print "ok 15\n";
+}