Front page | perl.perl5.porters |
Postings from July 2014
[perl #122392] xsubpp breaks typemap $func_args processing
Thread Next
From:
David Dyck
Date:
July 25, 2014 06:49
Subject:
[perl #122392] xsubpp breaks typemap $func_args processing
Message ID:
rt-4.0.18-15474-1406243017-1423.122392-75-0@perl.org
# New Ticket Created by David Dyck
# Please include the string: [perl #122392]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=122392 >
This is a bug report for perl from dcd@fluke.com,
generated with the help of perlbug 1.39 running under perl 5.16.0.
-----------------------------------------------------------------
[Please describe your issue here]
I have .xs and typemap code that I've been using for 10-plus years
that has recently broken.
Fragments of my typemap include
TYPEMAP
o_max T_O_MAX
and
INPUT
T_O_MAX
/* @{[ $func_args =~ s/\b$var\b/$var,sizeof $var/ ]} */
*$var = 0
this .xs code take an input fragment like:
MODULE = DPC3 PACKAGE = DPC3
PROTOTYPES: ENABLE
void
DPC3version(dllVersionBuf)
o_max dllVersionBuf
OUTPUT:
dllVersionBuf
and process it in a way that the function
DPCVOID DPC3version(
char * dllVersionBuf, /* pointer to the buffer */
int dllVersionBufSize); /* size of the buffer */
could be called.
( I've used this feature to allow 54 functions with buffer sized
to be called using this feature )
It's been a while since I dove into perl internals and packages,
so I could use some hints as to how to begin to diagnose and fix
this issue. ( I don't think the .xs file has been touched for ages either )
--
Here's a sample output of the generated .c file
#line 68 "DPC3.c"
XS(XS_DPC3_DPC3version); /* prototype to pass -Wmissing-prototypes */
XS(XS_DPC3_DPC3version)
{
#ifdef dVAR
dVAR; dXSARGS;
#else
dXSARGS;
#endif
if (items != 1)
Perl_croak(aTHX_ "Usage: %s(%s)", "DPC3::DPC3version", "dllVersionBuf");
PERL_UNUSED_VAR(cv); /* -W */
{
o_max dllVersionBuf;
/* 1 */
*dllVersionBuf = 0;
DPC3version(dllVersionBuf,sizeof dllVersionBuf);
sv_setpv(ST(0), dllVersionBuf );
SvSETMAGIC(ST(0));
}
XSRETURN_EMPTY;
}
---
The new generated code looks like this:
XS_EUPXS(XS_DPC3_DPC3version); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_DPC3_DPC3version)
{
dVAR; dXSARGS;
if (items != 1)
croak_xs_usage(cv, "dllVersionBuf");
{
o_max dllVersionBuf;
DPC3version(dllVersionBuf);
sv_setpv(ST(0), dllVersionBuf );
SvSETMAGIC(ST(0));
}
XSRETURN_EMPTY;
}
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=library
severity=high
module=ExtUtils::ParseXS
---
This perlbug was built using Perl 5.16.0 - Mon Mar 11 10:57:50 UTC 2013
It is being executed now by Perl 5.16.0 - Mon Mar 11 10:54:42 UTC 2013.
Site configuration information for perl 5.16.0:
Configured by abuild at Mon Mar 11 10:54:42 UTC 2013.
Summary of my perl5 (revision 5 version 16 subversion 0) configuration:
Platform:
osname=linux, osvers=3.4.6-2.10-default, archname=x86_64-linux-thread-multi
uname='linux build30 3.4.6-2.10-default #1 smp thu jul 26 09:36:26 utc 2012 (641c197) x86_64 x86_64 x86_64 gnulinux '
config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Dd_dbm_open -Duseshrplib=true -Doptimize=-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe -Accflags=-DPERL_USE_SAFE_PUTENV -Dotherlibdirs=/usr/lib/perl5/site_perl'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector'
ccversion='', gccversion='4.7.1 20120723 [gcc-4_7-branch revision 189773]', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib64 -fstack-protector'
libpth=/lib64 /usr/lib64 /usr/local/lib64
libs=-lm -ldl -lcrypt -lpthread
perllibs=-lm -ldl -lcrypt -lpthread
libc=/lib64/libc-2.15.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.15'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.16.0/x86_64-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib64 -fstack-protector'
Locally applied patches:
---
@INC for perl 5.16.0:
/usr0/dcd/perl5/lib/perl5/x86_64-linux-thread-multi
/usr0/dcd/perl5/lib/perl5
/usr/lib/perl5/site_perl/5.16.0/x86_64-linux-thread-multi
/usr/lib/perl5/site_perl/5.16.0
/usr/lib/perl5/vendor_perl/5.16.0/x86_64-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.16.0
/usr/lib/perl5/5.16.0/x86_64-linux-thread-multi
/usr/lib/perl5/5.16.0
/usr/lib/perl5/site_perl/5.16.0/x86_64-linux-thread-multi
/usr/lib/perl5/site_perl/5.16.0
/usr/lib/perl5/site_perl
.
---
Environment for perl 5.16.0:
HOME=/evtfs/home/dcd
LANG=en_US.UTF-8
LANGUAGE (unset)
LC_COLLATE=POSIX
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr0/dcd/perl5/bin:/usr0/dcd/bin:/usr0/dcd/sys/x86_64.linux:/usr0/hobbes/tools/scripts:/usr0/hobbes/tools/x86_64.linux:/usr0/hobbes/tools/scripts:/usr0/igdev/grponly/sw/tools/scripts:/opt/ecos/gnutools/arm-elf/bin:/evtfs/home/dcd/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/qt3/bin:/usr/sbin:/usr/ucb
PERL5LIB=/usr0/dcd/perl5/lib/perl5
PERL_BADLANG (unset)
SHELL=/bin/ksh
Thread Next
-
[perl #122392] xsubpp breaks typemap $func_args processing
by David Dyck