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

BBC: Blead breaks DCMERTENS/C-Blocks-0.42.tar.gz #19561

Closed
andk opened this issue Mar 24, 2022 · 8 comments
Closed

BBC: Blead breaks DCMERTENS/C-Blocks-0.42.tar.gz #19561

andk opened this issue Mar 24, 2022 · 8 comments
Labels
BBC Blead Breaks CPAN - changes in blead broke a cpan module(s) Closable? We might be able to close this ticket, but we need to check with the reporter
Milestone

Comments

@andk
Copy link
Contributor

andk commented Mar 24, 2022

Description

Tests started to fail on 5.35.10. Only non-threaded perls are to be investigated since the package is not thread safe.
Diagnostics output:

C::Blocks internal error: got null pointer for op function! at t/36-API-Creation.t line 13.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 2 just after 1.
t/36-API-Creation.t ................. Dubious, test returned 2 (wstat 512, 0x200)
All 1 subtests passed

Bisect leads to

75acd14e43f2ffb698fc7032498f31095b56adb5 is the first bad commit
commit 75acd14e43f2ffb698fc7032498f31095b56adb5
Author: Richard Leach <richardleach@users.noreply.github.com>
Date:   Sun Feb 6 22:52:54 2022 +0000

    Make newSV_type an inline function

Steps to Reproduce

cpan -i DCMERTENS/C-Blocks-0.42.tar.gz

Expected behavior

Should test the distro successfully and install it

Perl configuration

# perl -V output goes here
Summary of my perl5 (revision 5 version 35 subversion 10) configuration:                                  
  Commit id: 75acd14e43f2ffb698fc7032498f31095b56adb5
  Platform:
    osname=linux
    osvers=5.16.0-5-amd64
    archname=x86_64-linux
    uname='linux k93msid 5.16.0-5-amd64 #1 smp preempt debian 5.16.14-1 (2022-03-15) x86_64 gnulinux '
    config_args='-Dprefix=/home/sand/src/perl/repoperls/installed-perls/host/k93msid/v5.35.9-88-g75acd14e43/da1c -Dmyhostname=k93msid -Dinstallusrbinperl=n -Uversiononly -Dusedevel -des -Ui_db -Dlibswanted=cl pthread socket inet nsl gdbm dbm malloc dl ld sun m crypt sec util c cposix posix ucb BSD gdbm_compat -Uuseithreads -Uuselongdouble -DEBUGGING=-g'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
  Compiler:
    cc='cc'
    ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O2 -g'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='11.2.0'
    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/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib
    libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.33.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.33'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector-strong'


Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_TIMES
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_DEVEL
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
  Built under linux
  Compiled at Mar 24 2022 06:04:29
  @INC:
    /home/sand/src/perl/repoperls/installed-perls/host/k93msid/v5.35.9-88-g75acd14e43/da1c/lib/site_perl/5.35.10/x86_64-linux
    /home/sand/src/perl/repoperls/installed-perls/host/k93msid/v5.35.9-88-g75acd14e43/da1c/lib/site_perl/5.35.10
    /home/sand/src/perl/repoperls/installed-perls/host/k93msid/v5.35.9-88-g75acd14e43/da1c/lib/5.35.10/x86_64-linux
    /home/sand/src/perl/repoperls/installed-perls/host/k93msid/v5.35.9-88-g75acd14e43/da1c/lib/5.35.10

@richardleach
Copy link
Contributor

Thanks @andk.

I'm assuming that it's this test that fails (and the following one presumably would too).

cblock {
        AV * my_av = newAV();
        SvREFCNT_dec(my_av);
}
BEGIN { pass 'newAV does not cause croak' }

I'm not familiar with how cblocks work but will try to look into it. (Don't have much time right this minute though.)

The internal error comes from this code in lib/C/Blocks.xs:

OP * build_op(pTHX_ TCCState * state, int keyword_type) {
        /* build a null op if not creating a cblock */
        if (keyword_type != IS_CBLOCK) return newOP(OP_NULL, 0);
         
        /* get the function pointer for the block */
        IV pointer_IV = PTR2IV(tcc_get_symbol(state, "op_func"));
        if (pointer_IV == 0) {
                croak("C::Blocks internal error: got null pointer for op function!");
        }
         
        /* Store the address of the function pointer on the stack */
        OP * o = newUNOP(OP_RAND, 0, newSVOP(OP_CONST, 0, newSViv(pointer_IV)));
         
        /* Create an op that pops the address off the stack and invokes it */
        o->op_ppaddr = Perl_tcc_pp;
         
        return o;
}

My first guess is that since 75acd14 inlined newSV_type, this build_op function therefore can't find the symbol.

@richardleach
Copy link
Contributor

@run4flat - is C::Blocks currently able to handle other inline functions somehow? Or can you see any way that it could?

@jkeenan jkeenan added BBC Blead Breaks CPAN - changes in blead broke a cpan module(s) and removed Needs Triage labels Mar 24, 2022
@jkeenan jkeenan added this to the 5.35.11 milestone Mar 24, 2022
@xenu
Copy link
Member

xenu commented Mar 24, 2022

To me it looks like a bug in TCC. It successfully compiles the function below (in execute_compiler) and then it complains it can't find the op_func symbol (in build_op).

void op_func(C_BLOCKS_THX_DECL) {
        AV * my_av = newAV();
        SvREFCNT_dec(my_av);
}

@rjbs
Copy link
Member

rjbs commented Apr 17, 2022

I believe the general consensus is that this does not block the release of v5.36.0, and am marking it as such.

@run4flat
Copy link

run4flat commented Apr 17, 2022 via email

@richardleach
Copy link
Contributor

@run4flat - it doesn't seem like this is a bug in perl (and the breaking change seems entirely legitimate), so I propose to close this issue. Would you like me to create an issue on C::Blocks' bugtracker at the same time?

@richardleach richardleach added the Closable? We might be able to close this ticket, but we need to check with the reporter label May 2, 2022
@jkeenan
Copy link
Contributor

jkeenan commented Jul 11, 2022

@run4flat - it doesn't seem like this is a bug in perl (and the breaking change seems entirely legitimate), so I propose to close this issue. Would you like me to create an issue on C::Blocks' bugtracker at the same time?

+1 to your closing this ticket once you've opened a ticket in the bugtracker for C::Blocks.

@richardleach
Copy link
Contributor

Closed now that a ticket exists in the C::Blocks bugtracker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BBC Blead Breaks CPAN - changes in blead broke a cpan module(s) Closable? We might be able to close this ticket, but we need to check with the reporter
Projects
None yet
Development

No branches or pull requests

6 participants