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

DOC is wrong or OP_PADSV/AV/HV creation should be fixed #15898

Open
p5pRT opened this issue Feb 27, 2017 · 3 comments
Open

DOC is wrong or OP_PADSV/AV/HV creation should be fixed #15898

p5pRT opened this issue Feb 27, 2017 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 27, 2017

Migrated from rt.perl.org#130878 (status was 'open')

Searchable as RT130878$

@p5pRT
Copy link
Author

p5pRT commented Feb 27, 2017

From @KES777

Created by @KES777

According to the [DOC](http​://perldoc.perl.org/perlguts.html#Compile-pass-1%3a-check-routines)

A check routine is called when the node is fully constructed except for the execution-order thread

But for the OP_PADSV/AV/HV that is not true.
At this phase OP_PADANY is created and ck_routine is called for it.
Later the type of this OP is fixed by OP_PADSV/AV/HV

So when we do​:

  wrap_op_checker(OP_PADSV, my_check, &old_checker);

my_check will never be called.

[Here](https://github.com/KES777/perl/commit/b6e28567043f7deb474285fb40253573a88b589a#diff-0ca05518d51a09e56cb1dcfd96386a4bR4818)
I put three markers in order they should be called​:
1. When OP is created
2. When OP is transformed
3. When PL_check is called

But as this showen at this [example code](https://github.com/KES777/MyTest/blob/master/MyTest.xs#L86)
We get wrong trace which is inappropriate to the DOC​:

A check routine is called when the node is fully constructed

STACK 1 TYPE 12
Keyword 0
STACK XS
PRE
STACK 3 TYPE 12 <<<<< OP is not fully constructed yet
Keyword OLD 12
STACK 2 TYPE 12 <<<<It will be fully constructed after [this step ](https://github.com/KES777/perl/commit/b6e28567043f7deb474285fb40253573a88b589a#diff-0ca05518d51a09e56cb1dcfd96386a4bR9277)

[See full stacktrace](https://github.com/KES777/MyTest/blob/master/out)

I think [this](https://github.com/Perl/perl5/blob/blead/perly.y#L1144)
transformation is called too late and should be fixed.
[More info]([SO](http​://stackoverflow.com/questions/42455755/why-callback-is-not-called/42476409#42476409)
)

[Another source](https://st.aticpan.org/source/VPIT/autovivification-0.16/autovivification.xs)
where people faced into this problem.

/* Sadly, the padsv OPs we are interested in don't trigger the padsv check
* function, but are instead manually mutated from a padany.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl 5.24.0:

Configured by kes at Wed Oct 19 14:07:47 EEST 2016.

Summary of my perl5 (revision 5 version 24 subversion 0) configuration:
   
  Platform:
    osname=linux, osvers=4.4.0-43-generic, archname=x86_64-linux
    uname='linux work 4.4.0-43-generic #63-ubuntu smp wed oct 12 13:48:03 utc 2016 x86_64 x86_64 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/kes/perl5/perlbrew/perls/perl-5.24.0 -Aeval:scriptdir=/home/kes/perl5/perlbrew/perls/perl-5.24.0/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion='', gccversion='5.4.0 20160609', 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 =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64
    libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.23.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.23'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
    Devel::PatchPerl 1.38


@INC for perl 5.24.0:
    /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux
    /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0
    /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/x86_64-linux
    /home/kes/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0
    .


Environment for perl 5.24.0:
    HOME=/home/kes
    LANG=en_US.UTF-8
    LANGUAGE=en
    LC_ADDRESS=uk_UA.UTF-8
    LC_IDENTIFICATION=uk_UA.UTF-8
    LC_MEASUREMENT=uk_UA.UTF-8
    LC_MESSAGES=en_US.UTF-8
    LC_MONETARY=uk_UA.UTF-8
    LC_NAME=uk_UA.UTF-8
    LC_NUMERIC=uk_UA.UTF-8
    LC_PAPER=uk_UA.UTF-8
    LC_TELEPHONE=uk_UA.UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/kes/perl5/perlbrew/bin:/home/kes/perl5/perlbrew/perls/perl-5.24.0/bin:/home/kes/bin:/home/kes/bin:/home/kes/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
    PERLBREW=command perlbrew
    PERLBREW_BASHRC_VERSION=0.76
    PERLBREW_HOME=/home/kes/.perlbrew
    PERLBREW_MANPATH=/home/kes/perl5/perlbrew/perls/perl-5.24.0/man
    PERLBREW_PATH=/home/kes/perl5/perlbrew/bin:/home/kes/perl5/perlbrew/perls/perl-5.24.0/bin
    PERLBREW_PERL=perl-5.24.0
    PERLBREW_ROOT=/home/kes/perl5/perlbrew
    PERLBREW_VERSION=0.76
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Mar 29, 2017

From @iabyn

On Mon, Feb 27, 2017 at 02​:15​:28AM -0800, KES wrote​:

I think [this](https://github.com/Perl/perl5/blob/blead/perly.y#L1144)
transformation is called too late and should be fixed.

Where exactly to you think the padany should be converted to a pad*v,
and where do you think the check functions for padany and pad*v should be
called from?

--
Standards (n). Battle insignia or tribal totems.

@p5pRT
Copy link
Author

p5pRT commented Mar 29, 2017

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

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

2 participants