From: Nicholas Clark <nick@ccl4.org>
Date: Tue, 15 Jul 2008 14:51:53 +0000 (+0000)
Subject: Fix use of a variable before it is initialised, introduced by change
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=837cb3baceb77ebdb19584af90d9148242208eb6;p=p5sagit%2Fp5-mst-13.2.git

Fix use of a variable before it is initialised, introduced by change
34138, spotted by Jerry D. Hedden. I assume that he's compiling with
options that enable trace flow analysis from the C compiler.

p4raw-id: //depot/perl@34144
---

diff --git a/sv.c b/sv.c
index c2b4171..04d6e43 100644
--- a/sv.c
+++ b/sv.c
@@ -4402,11 +4402,11 @@ Perl_sv_chop(pTHX_ register SV *const sv, register const char *const ptr)
     }
     /* SvPVX(sv) may move in SV_CHECK_THINKFIRST(sv), but after this line,
        nothing uses the value of ptr any more.  */
+    max_delta = SvLEN(sv) ? SvLEN(sv) : SvCUR(sv);
     if (ptr <= SvPVX_const(sv))
 	Perl_croak(aTHX_ "panic: sv_chop ptr=%p, start=%p, end=%p",
 		   ptr, SvPVX_const(sv), SvPVX_const(sv) + max_delta);
     SV_CHECK_THINKFIRST(sv);
-    max_delta = SvLEN(sv) ? SvLEN(sv) : SvCUR(sv);
     if (delta > max_delta)
 	Perl_croak(aTHX_ "panic: sv_chop ptr=%p (was %p), start=%p, end=%p",
 		   SvPVX_const(sv) + delta, ptr, SvPVX_const(sv),