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

regexp branch reset changes broke $+ #20912

Closed
markov2 opened this issue Mar 8, 2023 · 2 comments · Fixed by #20913
Closed

regexp branch reset changes broke $+ #20912

markov2 opened this issue Mar 8, 2023 · 2 comments · Fixed by #20913
Assignees

Comments

@markov2
Copy link
Contributor

markov2 commented Mar 8, 2023

Description
At least in 5.37.8 and 5.37.10 and blead of today, the cooperation between branch reset and $+ is broken.
Very probably related to #20710, but a different effect of the same change.

Steps to Reproduce

  'b' =~ m/ (?| (a) (?{ defined $+ or die "fail!"; print "found $+\n" })
              | (b) (?{ defined $+ or die "fail!"; print "found $+\n" })
            ) /sx;

This should produce "found b", but produces a "fail!"

Perl configuration

 Summary of my perl5 (revision 5 version 37 subversion 10) configuration:
  Commit id: 067d2df440e3814f94fc68e4b8920522362283e8
  Platform:
    osname=linux
    osvers=5.3.18-lp152.98-default
    archname=x86_64-linux
    uname='linux moon 5.3.18-lp152.98-default #1 smp tue nov 2 08:14:49 utc 2021 (d179c1c) x86_64 x86_64 x86_64 gnulinux '
    config_args='-de -Dprefix=/tmp/perl-blead -Dusedevel'
    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'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='7.5.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/x86_64-suse-linux/lib /usr/lib /lib64 /usr/lib64 /lib /usr/local/lib64
    libs=-lpthread -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.26.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.26'
  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'


Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_TIMES
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_HASH_FUNC_SIPHASH13
    PERL_HASH_USE_SBOX32
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_DEVEL
    PERL_USE_SAFE_PUTENV
    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  8 2023 08:43:11
@demerphq
Copy link
Collaborator

demerphq commented Mar 8, 2023

Thanks, ill investigate later.

Yves

demerphq added a commit that referenced this issue Mar 8, 2023
I missed that $+ needs to do the parno_to_logical lookup.
We had tests for $^N, but not $+. This also fixes the code
for $^N to only do the lookup when the paren is not 0.

Fixes #20912
@demerphq
Copy link
Collaborator

demerphq commented Mar 8, 2023

Thank you for the report. Fixed pushed as #20913

@demerphq demerphq self-assigned this Mar 8, 2023
demerphq added a commit that referenced this issue Mar 8, 2023
I missed that $+ needs to do the parno_to_logical lookup.
We had tests for $^N, but not $+. This also fixes the code
for $^N to only do the lookup when the paren is not 0.

Fixes #20912
pjacklam pushed a commit to pjacklam/perl5 that referenced this issue May 20, 2023
I missed that $+ needs to do the parno_to_logical lookup.
We had tests for $^N, but not $+. This also fixes the code
for $^N to only do the lookup when the paren is not 0.

Fixes Perl#20912
pjacklam pushed a commit to pjacklam/perl5 that referenced this issue May 20, 2023
I missed that $+ needs to do the parno_to_logical lookup.
We had tests for $^N, but not $+. This also fixes the code
for $^N to only do the lookup when the paren is not 0.

Fixes Perl#20912
khwilliamson pushed a commit to khwilliamson/perl5 that referenced this issue Jul 10, 2023
I missed that $+ needs to do the parno_to_logical lookup.
We had tests for $^N, but not $+. This also fixes the code
for $^N to only do the lookup when the paren is not 0.

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

Successfully merging a pull request may close this issue.

2 participants