Skip Menu |
Report information
Id: 128665
Status: open
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: dcollinsn [at] gmail.com
Cc:
AdminCc:

Operating System: cygwin
PatchStatus: (no value)
Severity: low
Type:
Perl Version: 5.25.2
Fixed In: (no value)



Subject: Cygwin: trunc(2.75) is broken somewhere on long double builds
Download (untitled) / with headers
text/plain 4.2k
Hello! I'm seeing the following test failure on Cygwin long double builds. Threads are not required, building with the following is adequate: ./Configure -Dusedevel -des -Duselongdouble -Accflags=-D_GNU_SOURCE -Alibswanted=cygwin && make test_prep The two -A on the Configure line are workarounds to RT #128358 and RT #128637 dcollins@DESKTOP-ER38TCQ ~/perlstable $ ./perl -Ilib use strict; use POSIX ':math_h_c99'; use POSIX ':nan_payload'; use Test::More; is(trunc(2.25), 2, "trunc 2.25"); is(trunc(-2.25), -2, "trunc -2.25"); is(trunc(2.5), 2, "trunc 2.5"); is(trunc(-2.5), -2, "trunc -2.5"); is(trunc(2.75), 2, "trunc 2.75"); is(trunc(-2.75), -2, "trunc -2.75"); is(getpayload(nan(1234.567)), 1234, "nan (trunc) + getpayload"); ok 1 - trunc 2.25 ok 2 - trunc -2.25 ok 3 - trunc 2.5 ok 4 - trunc -2.5 not ok 5 - trunc 2.75 # Failed test 'trunc 2.75' # at - line 11. # got: '3' # expected: '2' not ok 6 - trunc -2.75 # Failed test 'trunc -2.75' # at - line 12. # got: '-3' # expected: '-2' not ok 7 - nan (trunc) + getpayload # Failed test 'nan (trunc) + getpayload' # at - line 13. # got: '1235' # expected: '1234' # Tests were run but no plan was declared and done_testing() was not seen. dcollins@DESKTOP-ER38TCQ ~/perlstable $ ./perl -Ilib -V Summary of my perl5 (revision 5 version 25 subversion 2) configuration: Commit id: 8c4723656080526a8392690f30ec46d642de80ba Platform: osname=cygwin, osvers=2.5.1(0.29753), archname=cygwin-thread-multi-ld uname='cygwin_nt-10.0 desktop-er38tcq 2.5.1(0.29753) 2016-04-21 22:14 x86_64 cygwin ' config_args='-Dusedevel -des -Doptimize=-O3 -g -Dusethreads -Duselongdouble -Accflags=-D_GNU_SOURCE -Alibswanted=cygwin' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define use64bitint=define, use64bitall=define, uselongdouble=define usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2', optimize='-O3 -g', cppflags='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong' ccversion='', gccversion='5.3.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='long double', nvsize=16, Off_t='off_t', lseeksize=8 alignbytes=16, prototype=define Linker and Libraries: ld='g++', ldflags =' -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong -L/usr/local/lib' libpth=/usr/lib /usr/lib/../lib/../include/w32api /usr/local/lib /lib libs=-lpthread -ldl -lcygwin perllibs=-lpthread -ldl -lcygwin libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=cygperl5_25_2.dll gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' --shared -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -L/usr/local/lib -fstack-protector-strong' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT 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_ITHREADS 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 USE_REENTRANT_API Built under cygwin Compiled at Jul 18 2016 13:14:50 @INC: lib /usr/local/lib/perl5/site_perl/5.25.2/cygwin-thread-multi-ld /usr/local/lib/perl5/site_perl/5.25.2 /usr/local/lib/perl5/5.25.2/cygwin-thread-multi-ld /usr/local/lib/perl5/5.25.2 /usr/local/lib/perl5/site_perl . -- Respectfully, Dan Collins
To: Perl5 Porters <perl5-porters [...] perl.org>
Subject: Re: [perl #128665] Cygwin: trunc(2.75) is broken somewhere on long double builds
From: Dan Collins <dcollinsn [...] gmail.com>
Date: Mon, 18 Jul 2016 14:44:46 -0400
Download (untitled) / with headers
text/plain 4.8k
In particular, trunc() seems to be using round towards nearest, ties to even, rather than round towards zero.

On Mon, Jul 18, 2016 at 1:34 PM, Dan Collins <perlbug-followup@perl.org> wrote:
Show quoted text
# New Ticket Created by  Dan Collins
# Please include the string:  [perl #128665]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=128665 >


Hello!

I'm seeing the following test failure on Cygwin long double builds. Threads are not required, building with the following is adequate:

./Configure -Dusedevel -des -Duselongdouble -Accflags=-D_GNU_SOURCE -Alibswanted=cygwin && make test_prep

The two -A on the Configure line are workarounds to RT #128358 and RT #128637

dcollins@DESKTOP-ER38TCQ ~/perlstable
$ ./perl -Ilib
use strict;

use POSIX ':math_h_c99';
use POSIX ':nan_payload';
use Test::More;

is(trunc(2.25), 2, "trunc 2.25");
is(trunc(-2.25), -2, "trunc -2.25");
is(trunc(2.5), 2, "trunc 2.5");
is(trunc(-2.5), -2, "trunc -2.5");
is(trunc(2.75), 2, "trunc 2.75");
is(trunc(-2.75), -2, "trunc -2.75");
is(getpayload(nan(1234.567)), 1234, "nan (trunc) + getpayload");
ok 1 - trunc 2.25
ok 2 - trunc -2.25
ok 3 - trunc 2.5
ok 4 - trunc -2.5
not ok 5 - trunc 2.75
#   Failed test 'trunc 2.75'
#   at - line 11.
#          got: '3'
#     expected: '2'
not ok 6 - trunc -2.75
#   Failed test 'trunc -2.75'
#   at - line 12.
#          got: '-3'
#     expected: '-2'
not ok 7 - nan (trunc) + getpayload
#   Failed test 'nan (trunc) + getpayload'
#   at - line 13.
#          got: '1235'
#     expected: '1234'
# Tests were run but no plan was declared and done_testing() was not seen.

dcollins@DESKTOP-ER38TCQ ~/perlstable
$ ./perl -Ilib -V
Summary of my perl5 (revision 5 version 25 subversion 2) configuration:
  Commit id: 8c4723656080526a8392690f30ec46d642de80ba
  Platform:
    osname=cygwin, osvers=2.5.1(0.29753), archname=cygwin-thread-multi-ld
    uname='cygwin_nt-10.0 desktop-er38tcq 2.5.1(0.29753) 2016-04-21 22:14 x86_64 cygwin '
    config_args='-Dusedevel -des -Doptimize=-O3 -g -Dusethreads -Duselongdouble -Accflags=-D_GNU_SOURCE -Alibswanted=cygwin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=define
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2',
    optimize='-O3 -g',
    cppflags='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong'
    ccversion='', gccversion='5.3.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='long double', nvsize=16, Off_t='off_t', lseeksize=8
    alignbytes=16, prototype=define
  Linker and Libraries:
    ld='g++', ldflags =' -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/lib /usr/lib/../lib/../include/w32api /usr/local/lib /lib
    libs=-lpthread -ldl -lcygwin
    perllibs=-lpthread -ldl -lcygwin
    libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=cygperl5_25_2.dll
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' --shared  -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -L/usr/local/lib -fstack-protector-strong'


Characteristics of this binary (from libperl):
  Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                        PERL_IMPLICIT_CONTEXT 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_ITHREADS 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 USE_REENTRANT_API
  Built under cygwin
  Compiled at Jul 18 2016 13:14:50
  @INC:
    lib
    /usr/local/lib/perl5/site_perl/5.25.2/cygwin-thread-multi-ld
    /usr/local/lib/perl5/site_perl/5.25.2
    /usr/local/lib/perl5/5.25.2/cygwin-thread-multi-ld
    /usr/local/lib/perl5/5.25.2
    /usr/local/lib/perl5/site_perl
    .

--
Respectfully,
Dan Collins


Subject: Re: [perl #128665] Cygwin: trunc(2.75) is broken somewhere on long double builds
From: Achim Gratz <Stromeko [...] nexgo.de>
Date: Mon, 18 Jul 2016 21:42:36 +0200
To: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 399b
Dan Collins writes: Show quoted text
> In particular, trunc() seems to be using round towards nearest, ties to > even, rather than round towards zero.
This seems to be a bug in Cygwin. The code in question was imported from MinGW-64, so it might have the same problem there. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ DIY Stuff: http://Synth.Stromeko.net/DIY.html
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 588b
On Mon Jul 18 12:43:19 2016, Stromeko@nexgo.de wrote: Show quoted text
> Dan Collins writes:
> > In particular, trunc() seems to be using round towards nearest, ties to > > even, rather than round towards zero.
> > This seems to be a bug in Cygwin. The code in question was imported > from MinGW-64, so it might have the same problem there. > > > Regards, > Achim.
Maybe. MinGW-w64 x86_64 builds have this entire test program (ext/POSIX/t/math.t) failing after test 28 in my build logs, so I'll have to look a bit more closely once I have that computer in front of me. -- Respectfully, Dan Collins
To: perl5-porters [...] perl.org
Date: Mon, 18 Jul 2016 21:56:39 +0200
Subject: Re: [perl #128665] Cygwin: trunc(2.75) is broken somewhere on long double builds
From: Achim Gratz <Stromeko [...] nexgo.de>
Download (untitled) / with headers
text/plain 549b
Dan Collins via RT writes: Show quoted text
> Maybe. MinGW-w64 x86_64 builds have this entire test program > (ext/POSIX/t/math.t) failing after test 28 in my build logs, so I'll > have to look a bit more closely once I have that computer in front of > me.
It was a bug in Cygwin that only affected truncl by sheer luck. Will be fixed in the next release. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Factory and User Sound Singles for Waldorf Q+, Q and microQ: http://Synth.Stromeko.net/Downloads.html#WaldorfSounds
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 589b
On Mon Jul 18 12:57:18 2016, Stromeko@nexgo.de wrote: Show quoted text
> Dan Collins via RT writes:
> > Maybe. MinGW-w64 x86_64 builds have this entire test program > > (ext/POSIX/t/math.t) failing after test 28 in my build logs, so I'll > > have to look a bit more closely once I have that computer in front of > > me.
> > It was a bug in Cygwin that only affected truncl by sheer luck. Will be > fixed in the next release. > > > Regards, > Achim.
Glad to hear it. Porters: my current builds of perl using the MinGW-w64 compilers are not affected, this is cygwin only. -- Respectfully, Dan Collins


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org