Front page | perl.perl5.porters |
Postings from February 2009
[perl #63322] PERL_ARGS_ASSERT_AV_MAKE is too strict
Thread Next
From:
Goro Fuji
Date:
February 18, 2009 23:34
Subject:
[perl #63322] PERL_ARGS_ASSERT_AV_MAKE is too strict
Message ID:
rt-3.6.HEAD-21965-1235008258-1875.63322-75-0@perl.org
# New Ticket Created by "Goro Fuji"
# Please include the string: [perl #63322]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=63322 >
This is a bug report for perl from gfuji@cpan.org.
generated with the help of perlbug 1.39 running under perl 5.11.0.
-----------------------------------------------------------------
The PERL_ARGS_ASSERT_AV_MAKE macro could break existing code.
I use av_make() to create a copy of an av, but "av_make(AvFILLp(av),
AvARRAY(av))" cause assertion failure when AvARRAY(av) is NULL.
Is it intended? or I have to do "AvFILLp(av) > -1 ?
av_make(AvFILLp(av), AvARRAY(av)) : newAV()", instead of
"av_make(AvFILLp(av), AvARRAY(av))"?
See the following:
/* proto.h */
#define PERL_ARGS_ASSERT_AV_MAKE \
assert(strp)
/* av.c */
AV *
Perl_av_make(pTHX_ register I32 size, register SV **strp)
{
register AV * const av = MUTABLE_AV(newSV_type(SVt_PVAV));
/* sv_upgrade does AvREAL_only() */
PERL_ARGS_ASSERT_AV_MAKE;
assert(SvTYPE(av) == SVt_PVAV);
if (size) { /* "defined" was returning undef for size==0 anyway. */
register SV** ary;
register I32 i;
Newx(ary,size,SV*);
AvALLOC(av) = ary;
AvARRAY(av) = ary;
AvFILLp(av) = AvMAX(av) = size - 1;
for (i = 0; i < size; i++) {
assert (*strp);
ary[i] = newSV(0);
sv_setsv(ary[i], *strp);
strp++;
}
}
return av;
}
----------------------------------------------------------------
---
Flags:
category=core
severity=medium
---
Site configuration information for perl 5.11.0:
Configured by s0710509 at Mon Feb 16 14:08:38 JST 2009.
Summary of my perl5 (revision 5 version 11 subversion 0) configuration:
Commit id: 23d483e2ac9eec5dd3415b4d8aad7ec7b0551ead
Platform:
osname=linux, osvers=2.6.9-42.0.3.elsmp, archname=i686-linux-thread-multi
uname='linux icho 2.6.9-42.0.3.elsmp #1 smp mon sep 25 17:28:02
edt 2006 i686 i686 i386 gnulinux '
config_args='-de -DDEBUGGING -Dusethreads -Dprefix=~
-Dinc_version_list=none -Doptimize=-O3 -Accflags=-Wall -Wextra
-DNO_MATHOMS -DPERL_GLOBAL_STRUCT'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -Wall -Wextra
-DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O3 -g',
cppflags='-D_REENTRANT -D_GNU_SOURCE -Wall -Wextra -DDEBUGGING
-fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='3.4.5 20051201 (Red Hat 3.4.5-2)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.3.4.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.3.4'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O3 -g -L/usr/local/lib'
Locally applied patches:
PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
PERL_GIT_UNCOMMITTED_CHANGES /* do not remove this line */
---
@INC for perl 5.11.0:
/home1/s0710509/lib/perl5/5.11.0/i686-linux-thread-multi
/home1/s0710509/lib/perl5/5.11.0
/home1/s0710509/lib/perl5/site_perl/5.11.0/i686-linux-thread-multi
/home1/s0710509/lib/perl5/site_perl/5.11.0
.
---
Environment for perl 5.11.0:
HOME=/home1/s0710509
LANG=C
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home1/s0710509/bin:/usr/kerberos/bin:/usr/java/jdk1.5.0_11/bin:/usr/java/jre1.5.0_11/bin:/usr/local/eclipse:/usr/local/netbeans-5.0/bin:/usr/local/Adobe/Acrobat7.0/bin:/usr/local/thunderbird:/usr/local/firefox:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
PERL_BADLANG (unset)
SHELL=/bin/bash
Thread Next
-
[perl #63322] PERL_ARGS_ASSERT_AV_MAKE is too strict
by Goro Fuji