Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xsubpp OUTLIST and PROTOTYPES conflict #16746

Closed
p5pRT opened this issue Nov 12, 2018 · 6 comments
Closed

xsubpp OUTLIST and PROTOTYPES conflict #16746

p5pRT opened this issue Nov 12, 2018 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 12, 2018

Migrated from rt.perl.org#133654 (status was 'resolved')

Searchable as RT133654$

@p5pRT
Copy link
Author

p5pRT commented Nov 12, 2018

From ailin@devio.us

Created by ailin@devio.us

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 `$$'.

Perl Info

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

@p5pRT
Copy link
Author

p5pRT commented Dec 5, 2018

From @tonycoz

On Mon, 12 Nov 2018 02​:57​:51 -0800, ailin@​devio.us wrote​:

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 028027e.

Tony

@p5pRT
Copy link
Author

p5pRT commented Dec 5, 2018

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2018

@tonycoz - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented May 22, 2019

From @khwilliamson

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.

@p5pRT
Copy link
Author

p5pRT commented May 22, 2019

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant