From: Dave Mitchell Date: Wed, 6 Jul 2005 20:09:29 +0000 (+0000) Subject: [perl #36470] 'undef $@; die' gives uninint value warning X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dc8d642c74abd1b6677ca197c9f517158a03b78c;p=p5sagit%2Fp5-mst-13.2.git [perl #36470] 'undef $@; die' gives uninint value warning p4raw-id: //depot/perl@25087 --- diff --git a/pp_sys.c b/pp_sys.c index 8cffb14..d05c547 100644 --- 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) diff --git a/t/op/die.t b/t/op/die.t index 6f62afb..a51333f 100755 --- a/t/op/die.t +++ b/t/op/die.t @@ -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"; +}