Skip to content

New test failures (beginning with perl-5.35.10) on -Duselongdouble builds when longdouble is "DoubleDouble" #19585

@sisyphus

Description

@sisyphus

The following addition to ext/Devel-Peek/Peek.t in perl-5.35.10 leads to 2 failed tests on perls built with-Duselongdouble iff the longdouble is "DoubleDouble":

+
+{
+    my $one = 1.0;
+    my $epsilon_p = 1.0;
+    $epsilon_p /= 2 while $one != $one + $epsilon_p / 2;
+    my $epsilon_n = 1.0;
+    $epsilon_n /= 2 while $one != $one - $epsilon_n / 2;
+
+    my $head = 'SV = NV\($ADDR\) at $ADDR
+(?:.+
+)*  ';
+    my $tail = '
+(?:.+
+)*';
+
+    do_test('NV 1.0', $one,
+            $head . 'NV = 1' . $tail);
+    do_test('NV 1.0 + epsilon', $one + $epsilon_p,
+            $head . 'NV = 1\.00000000\d+' . $tail);
+    do_test('NV 1.0 - epsilon', $one - $epsilon_p,
+            $head . 'NV = 0\.99999999\d+' . $tail);
+}
+

Module:
Devel::Peek

Description

Provided above.

Steps to Reproduce

Just build current blead on a system where longdouble is "DoubleDouble" and then run:

./perl -I./lib -T ext/Devel-Peek/t/Peek.t

You'll get output that terminates as follows:

....
ok 139 - DumpProg() has no 'Attempt to free X prematurely' warning
not ok 140 - NV 1.0
#   Failed test 'NV 1.0'
#   at ext/Devel-Peek/t/Peek.t line 109.
#
#                   'SV = PVNV(0x2644bbc0) at 0x2640d2b0
#   REFCNT = 1
#   FLAGS = (IOK,NOK,pIOK,pNOK)
#   IV = 1
#   NV = 1
#   PV = 0
# '
#     doesn't match '(?^ms:\A(?:ALLOCATED at .*?
# )?SV = NV\(0x[[:xdigit:]]+\) at 0x[[:xdigit:]]+
# (?:.+
# )*  NV = 1
# (?:.+
# )*\Z)'
#
# line 1587
ok 141 - NV 1.0 (unchanged by dump)
ok 142 - NV 1.0 + epsilon
ok 143 - NV 1.0 + epsilon (unchanged by dump)
not ok 144 - NV 1.0 - epsilon
#   Failed test 'NV 1.0 - epsilon'
#   at ext/Devel-Peek/t/Peek.t line 109.
#
#                   'SV = NV(0x25bfe850) at 0x26434448
#   REFCNT = 1
#   FLAGS = (NOK,pNOK)
#   NV = 1.00000000000000000000000000000002
# '
#     doesn't match '(?^ms:\A(?:ALLOCATED at .*?
# )?SV = NV\(0x[[:xdigit:]]+\) at 0x[[:xdigit:]]+
# (?:.+
# )*  NV = 0\.99999999\d+
# (?:.+
# )*\Z)'
#
# line 1591
ok 145 - NV 1.0 - epsilon (unchanged by dump)
1..145
# Looks like you failed 2 tests of 145.

Expected behavior

I don't immediately recognize what's being tested here.
(The test script, including the do_test() code, looks quite perlish to me, and I'm not really the "perlish" type.)
If someone likes to come up with a simple demo case of what's failing here, then that's all the better.
Otherwise, I'll put my thinking cap on tomorrow ... and try to work it out.

Perl configuration

# perl -V output goes here

$ ./perl -I./lib -V
Summary of my perl5 (revision 5 version 35 subversion 11) configuration:
Commit id: 2caf827
Platform:
osname=linux
osvers=3.2.0-4-powerpc64
archname=ppc64-linux-ld
uname='linux debian-sis 3.2.0-4-powerpc64 #1 smp debian 3.2.78-1 ppc64 gnulinux '
config_args='-des -Duse64bitall -Dcc=gcc -m64 -Dprefix=/home/sisyphus-sis/perl53511-m64-ld -Duselongdouble -Dusedevel -Uversiononly'
hint=recommended
useposix=true
d_sigaction=define
useithreads=undef
usemultiplicity=undef
use64bitint=define
use64bitall=define
uselongdouble=define
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='gcc -m64'
ccflags ='-std=gnu99 -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
optimize='-O1'
cppflags='-std=gnu99 -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion=''
gccversion='4.6.3'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=87654321
doublekind=4
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=6
ivtype='long'
ivsize=8
nvtype='long double'
nvsize=16
Off_t='off_t'
lseeksize=8
alignbytes=16
prototype=define
Linker and Libraries:
ld='gcc -m64'
ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib /lib/powerpc-linux-gnu /lib/../lib /usr/lib/powerpc-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.13.so
so=so
useshrplib=false
libperl=libperl.a
gnulibc_version='2.13'
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E'
cccdlflags='-fPIC'
lddlflags='-shared -O1 -L/usr/local/lib -fstack-protector'

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_LONG_DOUBLE
USE_PERLIO
USE_PERL_ATOF
Built under linux
Compiled at Apr 5 2022 18:11:14
@inc:
./lib
/home/sisyphus-sis/perl53511-m64-ld/lib/site_perl/5.35.11/ppc64-linux-ld
/home/sisyphus-sis/perl53511-m64-ld/lib/site_perl/5.35.11
/home/sisyphus-sis/perl53511-m64-ld/lib/5.35.11/ppc64-linux-ld
/home/sisyphus-sis/perl53511-m64-ld/lib/5.35.11

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