develooper Front page | perl.perl5.porters | Postings from April 2018

[perl #133131] Blead Breaks CPAN: Devel::Cover

Thread Previous | Thread Next
From:
Aaron Crane
Date:
April 20, 2018 16:19
Subject:
[perl #133131] Blead Breaks CPAN: Devel::Cover
Message ID:
rt-4.0.24-1039-1524241172-1548.133131-75-0@perl.org
# New Ticket Created by  Aaron Crane 
# Please include the string:  [perl #133131]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=133131 >


This is a bug report for perl from arc@cpan.org,
generated with the help of perlbug 1.41 running under perl 5.27.11.


-----------------------------------------------------------------
[Please describe your issue here]

Commit 7c114860c0fa8ade5e00a4b609d2fbd11d5a494c introduced an
optimisation in pp_iter(). Before the optimisation, pp_iter() pushed
either &PL_SV_yes or &PL_sv_no to the stack, and returned the op_next
in the obvious way.

The optimisation takes advantage of the fact that the op_next of an
OP_ITER always points to an OP_AND node, so pp_iter() now directly
jumps to either the op_next or the op_other of the OP_AND as
appropriate. The commit message also says this:

  It's possible that some weird optree-munging XS module may break this
  assumption. For now I've just added asserts that the next op is OP_AND
  with an op_ppaddr of Perl_pp_and; if that assertion fails, it may be
  necessary to convert pp_iter()s' asserts into conditional statements.

However, Devel::Cover does change the op_ppaddr of the ops it can see,
so the assertions on op_ppaddr were being tripped when Devel::Cover
was run under a -DDEBUGGING Perl. But even if the asserts didn't trip,
skipping the OP_AND nodes would prevent Devel::Cover from determining
branch coverage in the way that it wants.

The attached patch converts the asserts into conditional statements,
as outlined in the commit message above, and undoes the optimisation
when the op_ppaddr doesn't match.

With this change, tests pass for me on a DEBUGGING Perl (and allow the
Devel::Cover tests to pass also). Tests also pass when the
optimisation is fully disabled (so I have some confidence that my
deoptimisation is working correctly). However, I'd be grateful for
further review of the change — Dave, I'm hoping you're well placed to
do that.

I believe a fix for this issue should be applied despite the state of
the freeze, so I will add this ticket to the 5.28 blockers.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl 5.27.11:

Configured by arc at Fri Apr 20 15:05:50 CEST 2018.

Summary of my perl5 (revision 5 version 27 subversion 11) configuration:
  Derived from: affe54fad590821990edb8bd8db47d6e898c9114
  Platform:
    osname=darwin
    osvers=13.4.0
    archname=darwin-2level
    uname='darwin daybreak 13.4.0 darwin kernel version 13.4.0: mon
jan 11 18:17:34 pst 2016; root:xnu-2422.115.15~1release_x86_64 x86_64
i386 macbookpro11,3 darwin '
    config_args='-des -Dusedevel -Dprefix=/tmp/blead -DEBUGGING -Dcc=gcc-mp-4.8'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='gcc-mp-4.8'
    ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.9
-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV'
    optimize='-O3 -g'
    cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.9
-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -I/opt/local/include'
    ccversion=''
    gccversion='4.8.5'
    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='gcc-mp-4.8'
    ldflags =' -mmacosx-version-min=10.9 -fstack-protector
-L/opt/local/lib -L/usr/local/lib -L/opt/local/lib/libgcc'
    libpth=/opt/local/lib
/opt/local/lib/gcc48/gcc/x86_64-apple-darwin13/4.8.5/include-fixed
/usr/lib /usr/local/lib /opt/local/lib/libgcc
    libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc
    perllibs=-lpthread -ldl -lm -lutil -lc
    libc=
    so=dylib
    useshrplib=false
    libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=bundle
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags=' -mmacosx-version-min=10.9 -bundle -undefined
dynamic_lookup -L/opt/local/lib -L/usr/local/lib
-L/opt/local/lib/libgcc -fstack-protector'

Locally applied patches:
    uncommitted-changes

---
@INC for perl 5.27.11:
    /tmp/blead/lib/perl5/site_perl/5.27.11/darwin-2level
    /tmp/blead/lib/perl5/site_perl/5.27.11
    /tmp/blead/lib/perl5/5.27.11/darwin-2level
    /tmp/blead/lib/perl5/5.27.11

---
Environment for perl 5.27.11:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/arc
    LANG=en_GB.UTF-8
    LANGUAGE (unset)
    LC_COLLATE=C
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11R6/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About