(replaced by #14303)
Rafael Garcia-Suarez [Tue, 15 Jan 2002 23:02:44 +0000 (00:02 +0100)]
Subject: [PATCH] length of undefined $(digit) should warn
Message-ID: <20020115230244.A31786@rafael>

p4raw-id: //depot/perl@14302

mg.c
t/lib/warnings/mg

diff --git a/mg.c b/mg.c
index 49f8bc4..c7ebca3 100644 (file)
--- 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 '+':
index f224335..6c9e271 100644 (file)
@@ -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.