summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2017-06-01 16:28:21 +0200
committerYves Orton <demerphq@gmail.com>2017-06-01 17:17:34 +0200
commit84610c522ba9c4c14999a7c317050818363d5b7c (patch)
tree3a32bd01b8d2aa1bf22978d3cb81776440a3e7ba /av.c
parentb02f36453d1392e2b0bd62fdde2b286fb60bd5bc (diff)
downloadperl-84610c522ba9c4c14999a7c317050818363d5b7c.tar.gz
av.c: silence compiler warning
av.c: In function ‘Perl_av_undef’: av.c:577:35: warning: ‘orig_ix’ may be used uninitialized in this function [-Wmaybe-uninitialized] PL_tmps_stack[orig_ix] = &PL_sv_undef; The warning is bogus, as we only use the orig_ix if real is true, and if real is true we will have set orig_ix. But it doesnt cost much to initialize it always and shut up the compiler.
Diffstat (limited to 'av.c')
-rw-r--r--av.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/av.c b/av.c
index 5afae8d424..cf3386c92c 100644
--- a/av.c
+++ b/av.c
@@ -542,7 +542,7 @@ void
Perl_av_undef(pTHX_ AV *av)
{
bool real;
- SSize_t orig_ix;
+ SSize_t orig_ix = PL_tmps_ix; /* silence bogus warning about possible unitialized use */
PERL_ARGS_ASSERT_AV_UNDEF;
assert(SvTYPE(av) == SVt_PVAV);
@@ -551,7 +551,8 @@ Perl_av_undef(pTHX_ AV *av)
if (SvTIED_mg((const SV *)av, PERL_MAGIC_tied))
av_fill(av, -1);
- if ((real = cBOOL(AvREAL(av)))) {
+ real = cBOOL(AvREAL(av));
+ if (real) {
SSize_t key = AvFILLp(av) + 1;
/* avoid av being freed when calling destructors below */