Skip Menu |
Report information
Id: 133654
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: ailin [at] devio.us
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: medium
Type: library
Perl Version: 5.26.2
Fixed In: (no value)



From: ailin.nemui [...] gmail.com
Subject: xsubpp OUTLIST and PROTOTYPES conflict
Date: Mon, 12 Nov 2018 11:57:17 +0100
To: perlbug [...] perl.org
Download (untitled) / with headers
text/plain 5.3k
This is a bug report for perl from ailin@devio.us, generated with the help of perlbug 1.40 running under perl 5.26.2. ----------------------------------------------------------------- xsubpp generates code that cannot be used from Perl, if prototypes are used together with an OUTLIST parameter. See the following example code: #define PERL_NO_GET_CONTEXT MODULE = Test PACKAGE = Test PROTOTYPES: ENABLE int s_c_f_w(str, width, OUTLIST bytes) char *str unsigned int width unsigned int bytes C_ARGS: str, width, &bytes If compiled, results in: $ xsubpp Test.xs XS_EUPXS(XS_Test_s_c_f_w); /* prototype to pass -Wmissing-prototypes */ XS_EUPXS(XS_Test_s_c_f_w) { dVAR; dXSARGS; if (items != 2) croak_xs_usage(cv, "str, width"); { ... (void)newXSproto_portable("Test::s_c_f_w", XS_Test_s_c_f_w, file, "$$$"); ... The prototype is set as `$$$' but the items is checked for being 2. Note, the items check is correct and the prototype should be `$$'. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=library severity=medium module=ExtUtils::ParseXS --- Site configuration information for perl 5.26.2: Configured by reproducible at Wed May 23 12:00:00 UTC 2018. Summary of my perl5 (revision 5 version 26 subversion 2) configuration: Platform: osname=linux osvers=4.17.0-1-default archname=x86_64-linux-thread-multi uname='reproducible' 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 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -Wall -pipe -Accflags=-DPERL_USE_SAFE_PUTENV -Dotherlibdirs=/usr/lib/perl5/site_perl -Dinc_version_list=5.26.1/x86_64-linux-thread-multi 5.26.1' hint=recommended useposix=true d_sigaction=define useithreads=define usemultiplicity=define use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='cc' ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' optimize='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -Wall -pipe' cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong' ccversion='' gccversion='8.1.1 20180523 [gcc-8-branch revision 260570]' gccosandvers='' intsize=4 longsize=8 ptrsize=8 doublesize=8 byteorder=12345678 doublekind=3 d_longlong=define longlongsize=8 d_longdbl=define longdblsize=16 longdblkind=3 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-strong' libpth=/usr/local/lib /usr/lib64/gcc/x86_64-suse-linux/8/include-fixed /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64 libs=-lm -ldl -lcrypt -lpthread perllibs=-lm -ldl -lcrypt -lpthread libc=/lib64/libc-2.27.so so=so useshrplib=true libperl=libperl.so gnulibc_version='2.27' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=so d_dlsymun=undef ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.26.2/x86_64-linux-thread-multi/CORE' cccdlflags='-fPIC' lddlflags='-shared -L/usr/local/lib64 -fstack-protector-strong' --- @INC for perl 5.26.2: /home/ailin/perl5/5.26.2/lib/perl5/5.26.2/x86_64-linux-thread-multi /home/ailin/perl5/5.26.2/lib/perl5/5.26.2 /home/ailin/perl5/5.26.2/lib/perl5/x86_64-linux-thread-multi /home/ailin/perl5/5.26.2/lib/perl5 /usr/lib/perl5/site_perl/5.26.2/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.26.2 /usr/lib/perl5/vendor_perl/5.26.2/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.26.2 /usr/lib/perl5/5.26.2/x86_64-linux-thread-multi /usr/lib/perl5/5.26.2 /home/ailin/perl5/5.26.2/lib/perl5/5.26.1 /usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.26.1 /usr/lib/perl5/site_perl --- Environment for perl 5.26.2: HOME=/home/ailin LANG=en_US.UTF-8 LANGUAGE (unset) LC_COLLATE=C LC_CTYPE=zh_CN.UTF-8 LC_MEASUREMENT=en_IE.UTF-8 LC_MONETARY=de_DE.UTF-8 LC_NUMERIC=en_IE.UTF-8 LC_PAPER=de_DE.UTF-8 LC_TIME=en_IE.UTF-8 LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/ailin/perl5/5.26.2/bin:/home/ailin/perl6/bin:/home/ailin/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/snap/bin PERL5LIB=/home/ailin/perl5/5.26.2/lib/perl5 PERLDOC_PAGER=less -s PERL_BADLANG (unset) PERL_LOCAL_LIB_ROOT=/home/ailin/perl5/5.26.2 PERL_MB_OPT=--install_base "/home/ailin/perl5/5.26.2" PERL_MM_OPT=INSTALL_BASE=/home/ailin/perl5/5.26.2 SHELL=/usr/bin/zsh
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1016b
On Mon, 12 Nov 2018 02:57:51 -0800, ailin@devio.us wrote: Show quoted text
> xsubpp generates code that cannot be used from Perl, if prototypes are > used together with an OUTLIST parameter. See the following example > code: > > #define PERL_NO_GET_CONTEXT > > MODULE = Test PACKAGE = Test > PROTOTYPES: ENABLE > > int > s_c_f_w(str, width, OUTLIST bytes) > char *str > unsigned int width > unsigned int bytes > C_ARGS: > str, width, &bytes > > If compiled, results in: > > $ xsubpp Test.xs > > XS_EUPXS(XS_Test_s_c_f_w); /* prototype to pass -Wmissing-prototypes > */ > XS_EUPXS(XS_Test_s_c_f_w) > { > dVAR; dXSARGS; > if (items != 2) > croak_xs_usage(cv, "str, width"); > { > ... > > (void)newXSproto_portable("Test::s_c_f_w", XS_Test_s_c_f_w, file, > "$$$"); > ... > > The prototype is set as `$$$' but the items is checked for being > 2. Note, the items check is correct and the prototype should be `$$'.
This should be fixed by 028027e3fb6bba4f720b334e63e26f97a49cf6be. Tony
Download (untitled) / with headers
text/plain 313b
Thank you for filing this report. You have helped make Perl better. With the release today of Perl 5.30.0, this and 160 other issues have been resolved. Perl 5.30.0 may be downloaded via: https://metacpan.org/release/XSAWYERX/perl-5.30.0 If you find that the problem persists, feel free to reopen this ticket.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org