Front page | perl.perl5.porters |
Postings from August 2011
[perl #98092] "Attempt to free unreferenced scalar" from dist/threads-shared/t/clone.t
Thread Previous
From:
Nicholas Clark
Date:
August 30, 2011 09:46
Subject:
[perl #98092] "Attempt to free unreferenced scalar" from dist/threads-shared/t/clone.t
Message ID:
rt-3.6.HEAD-31297-1314722792-1095.98092-75-0@perl.org
# New Ticket Created by Nicholas Clark
# Please include the string: [perl #98092]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=98092 >
This is a bug report for perl from nick@ccl4.org,
generated with the help of perlbug 1.39 running under perl 5.15.1.
-----------------------------------------------------------------
[Please describe your issue here]
$ ./perl -Ilib dist/threads-shared/t/clone.t
1..34
ok 1 - Loaded
ok 2 - number
ok 3 - string
ok 4 - 1 arg
ok 5 - cloned string
ok 6 - cloned scalar ref
ok 7 - cloned scalar ref in thread
ok 8 - Circular ref typ
ok 9 - Circular ref
ok 10 - Circular ref in thread
Attempt to free unreferenced scalar: SV 0x91eeb0, Perl interpreter: 0x973840 at dist/threads-shared/t/clone.t line 86.
Attempt to free unreferenced scalar: SV 0x91eec8, Perl interpreter: 0x973840 at dist/threads-shared/t/clone.t line 86.
Attempt to free unreferenced scalar: SV 0x8d15b8, Perl interpreter: 0x973840 at dist/threads-shared/t/clone.t line 86.
ok 11 - Cloned circular refs from thread
ok 12 - Cloned array
ok 13 - Clone mod
ok 14 - Original array
ok 15 - Clone mod in thread
Attempt to free unreferenced scalar: SV 0x902d18, Perl interpreter: 0x74ce60 at dist/threads-shared/t/clone.t line 108.
Attempt to free unreferenced scalar: SV 0x902d30, Perl interpreter: 0x74ce60 at dist/threads-shared/t/clone.t line 108.
Attempt to free unreferenced scalar: SV 0x977fd8, Perl interpreter: 0x74ce60 at dist/threads-shared/t/clone.t line 108.
ok 16 - Clone mod from thread
[etc, no more warnings]
The test case resists most attempts to simplify it - removing seemingly
unrelated earlier blocks from the test case removes the warning.
git bisect found that the warning started with this commit
commit da6b625f78f5f1335aee4b2f800c850ca4fbf7d9
Author: Father Chrysostomos <sprout@cpan.org>
Date: Wed Aug 24 18:04:26 2011 -0700
Make $class->method work when $class is tied
[lengthy explanation in commit message trimmed here]
It's not obvious at all to me why the code change would cause that warning:
diff --git a/pp_hot.c b/pp_hot.c
index dd0b04d..fbe195f 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2935,10 +2935,16 @@ S_method_common(pTHX_ SV* meth, U32* hashp)
ob = MUTABLE_SV(SvRV(sv));
else {
GV* iogv;
+ bool packname_is_utf8 = FALSE;
/* this isn't a reference */
- if(SvOK(sv) && (packname = SvPV_const(sv, packlen))) {
- const HE* const he = hv_fetch_ent(PL_stashcache, sv, 0, 0);
+ if(SvOK(sv) && (packname = SvPV_nomg_const(sv, packlen))) {
+ const HE* const he =
+ (const HE *)hv_common_key_len(
+ PL_stashcache, packname,
+ packlen * -(packname_is_utf8 = !!SvUTF8(sv)), 0, NULL, 0
+ );
+
if (he) {
stash = INT2PTR(HV*,SvIV(HeVAL(he)));
goto fetch;
@@ -2947,7 +2953,9 @@ S_method_common(pTHX_ SV* meth, U32* hashp)
if (!SvOK(sv) ||
!(packname) ||
- !(iogv = gv_fetchsv(sv, 0, SVt_PVIO)) ||
+ !(iogv = gv_fetchpvn_flags(
+ packname, packlen, SVf_UTF8 * packname_is_utf8, SVt_PVIO
+ )) ||
!(ob=MUTABLE_SV(GvIO(iogv))))
{
/* this isn't the name of a filehandle either */
The above looks perfectly sane and reasonable. So why does it create
warnings?
Nicholas Clark
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=library
severity=low
module=threads::shared
---
Site configuration information for perl 5.15.1:
Configured by nick at Wed Jul 27 20:44:22 BST 2011.
Summary of my perl5 (revision 5 version 15 subversion 1) configuration:
Commit id: 747627ec455e0765e07733ece1545aa3f728a00a
Platform:
osname=freebsd, osvers=7.0-stable, archname=i386-freebsd-64int
uname='freebsd plum.flirble.org 7.0-stable freebsd 7.0-stable #7: sat jul 26 20:39:26 bst 2008 root@plum.flirble.org:usrobjusrsrcsysplum i386 '
config_args='-Dusedevel=y -Dcc=ccache gcc -Dld=gcc -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick@ccl4.org -Dperladmin=nick@ccl4.org -Dinc_version_list= -Dinc_version_list_init=0 -Doptimize=-g -Uusethreads -Duse64bitint -Accflags=-DNO_MATHOMS -Uusemymalloc -Duseperlio -Dprefix=~/Sandpit/snap5.9.x-v5.15.1-64-g747627e -Dinstallman1dir=none -Dinstallman3dir=none -Uuserelocatableinc -de'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='ccache gcc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DNO_MATHOMS -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include',
optimize='-g',
cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DNO_MATHOMS -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.2.1 20070719 [FreeBSD]', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags ='-Wl,-E -fstack-protector -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lgdbm -lm -lcrypt -lutil -lc
perllibs=-lm -lcrypt -lutil -lc
libc=, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib -fstack-protector'
Locally applied patches:
---
@INC for perl 5.15.1:
lib
/home/nick/Sandpit/snap5.9.x-v5.15.1-64-g747627e/lib/perl5/site_perl/5.15.1/i386-freebsd-64int
/home/nick/Sandpit/snap5.9.x-v5.15.1-64-g747627e/lib/perl5/site_perl/5.15.1
/home/nick/Sandpit/snap5.9.x-v5.15.1-64-g747627e/lib/perl5/5.15.1/i386-freebsd-64int
/home/nick/Sandpit/snap5.9.x-v5.15.1-64-g747627e/lib/perl5/5.15.1
.
---
Environment for perl 5.15.1:
HOME=/home/nick
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/nick/bin:/usr/flirble/admin/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/home/nick/bin:/usr/local/sbin:/sbin:/usr/sbin
PERL_BADLANG (unset)
SHELL=/usr/local/bin/bash
Thread Previous