From b6f8df71d5e985ce8ae65d0fa6dad736bb651b45 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Wed, 16 Jan 2002 00:02:44 +0100 Subject: (replaced by #14303) Subject: [PATCH] length of undefined $(digit) should warn Message-ID: <20020115230244.A31786@rafael> p4raw-id: //depot/perl@14302 --- mg.c | 8 ++++++++ t/lib/warnings/mg | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/mg.c b/mg.c index 49f8bc413c..c7ebca3817 100644 --- a/mg.c +++ b/mg.c @@ -458,6 +458,14 @@ Perl_magic_len(pTHX_ SV *sv, MAGIC *mg) Perl_croak(aTHX_ "panic: magic_len: %"IVdf, (IV)i); return i; } + else { + if (ckWARN(WARN_UNINITIALIZED)) + report_uninit(); + } + } + else { + if (ckWARN(WARN_UNINITIALIZED)) + report_uninit(); } return 0; case '+': diff --git a/t/lib/warnings/mg b/t/lib/warnings/mg index f2243357b3..6c9e271017 100644 --- a/t/lib/warnings/mg +++ b/t/lib/warnings/mg @@ -42,3 +42,10 @@ $|=1; $SIG{"INT"} = "fred"; kill "INT",$$; EXPECT +######## +# mg.c +use warnings 'uninitialized'; +'foo' =~ /(b)(a)(r)/; +length $3; +EXPECT +Use of uninitialized value in length at - line 4. -- cgit v1.2.1