Skip to content

sv_streq_flags() API doesn't skip "" overloading with SV_SKIP_OVERLOAD #24319

@tonycoz

Description

@tonycoz

Module:

Description

The documentation for sv_streq() claims it behaves like $x eq $y but it inconsistently applies overloading when SV_SKIP_OVERLOAD is supplied.

Steps to Reproduce

Requires a built perl tree for access to XS::APItest:

$ ./perl -Ilib -MXS::APItest -e 'use v5.40; package X { use overload q("") => sub {"DEF"}, fallback => 1; } my $x = bless {}, "X"; my $y = bless {}, "X"; say sv_streq_flags($x, $y, SV_SKIP_OVERLOAD) // "0";'
1
tony@venus:.../git/perl6$ ./perl -Ilib -MXS::APItest -e 'use v5.40; package X { use overload q("") => sub {"DEF"}, fallback => 1; } my $x = bless {}, "X"; my $y = bless {}, "X"; no overloading; say $x eq $y || "0";'
0

Note that sv_streq_flags(..., SV_SKIP_OVERLOAD) indicates they're equal, but the eq operator indicates they're unequal with overloading disabled.

Expected behavior

sv_streq_flags(SV_SKIP_OVERLOAD) behaves like the eq operator under no overloading:

$ ./perl -Ilib -MXS::APItest -e 'use v5.40; package X { use overload q("") => sub {"DEF"}, fallback => 1; } my $x = bless {}, "X"; my $y = bless {}, "X"; say sv_streq_flags($x, $y, SV_SKIP_OVERLOAD) // "0";'
0

Perl configuration

Summary of my perl5 (revision 5 version 43 subversion 10) configuration:
  Commit id: a762010550986c9a45ac3a58d08d70ef1e980b7d
  Platform:
    osname=linux
    osvers=6.12.63+deb13-amd64
    archname=x86_64-linux
    uname='linux venus 6.12.63+deb13-amd64 #1 smp preempt_dynamic debian 6.12.63-1 (2025-12-30) x86_64 gnulinux '
    config_args='-des -Dusedevel -Doptimize=-O2 -ggdb3'
    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 -ggdb3'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='14.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 /usr/lib64
    libs=-lpthread -lgdbm -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
    libc=/lib/x86_64-linux-gnu/libc.so.6
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.41'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -ggdb3 -L/usr/local/lib -fstack-protector-strong'


Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_LONG_DOUBLE
    HAS_STRTOLD
    HAS_TIMES
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    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 25 2026 11:45:40
  %ENV:
    PERLBREW_BASHRC_VERSION="0.43"
    PERLBREW_HOME="/home/tony/.perlbrew"
    PERLBREW_MANPATH=""
    PERLBREW_PATH="/home/tony/perl5/perlbrew/bin"
    PERLBREW_ROOT="/home/tony/perl5/perlbrew"
    PERLBREW_VERSION="0.67"
  @INC:
    lib
    /usr/local/lib/perl5/site_perl/5.43.10/x86_64-linux
    /usr/local/lib/perl5/site_perl/5.43.10
    /usr/local/lib/perl5/5.43.10/x86_64-linux
    /usr/local/lib/perl5/5.43.10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions