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

Cygwin: trunc(2.75) is broken somewhere on long double builds #15459

Open
p5pRT opened this issue Jul 18, 2016 · 7 comments
Open

Cygwin: trunc(2.75) is broken somewhere on long double builds #15459

p5pRT opened this issue Jul 18, 2016 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 18, 2016

Migrated from rt.perl.org#128665 (status was 'open')

Searchable as RT128665$

@p5pRT
Copy link
Author

p5pRT commented Jul 18, 2016

From @dcollinsn

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​: 8c47236
  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

@p5pRT
Copy link
Author

p5pRT commented Jul 18, 2016

From @dcollinsn

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​:

# 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-archive.perl.org/perl5/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​: 8c47236
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

@p5pRT
Copy link
Author

p5pRT commented Jul 18, 2016

From Stromeko@nexgo.de

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.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

DIY Stuff​:
http​://Synth.Stromeko.net/DIY.html

@p5pRT
Copy link
Author

p5pRT commented Jul 18, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 18, 2016

From @dcollinsn

On Mon Jul 18 12​:43​:19 2016, Stromeko@​nexgo.de wrote​:

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

@p5pRT
Copy link
Author

p5pRT commented Jul 18, 2016

From Stromeko@nexgo.de

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.
--
+<[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

@p5pRT
Copy link
Author

p5pRT commented Jul 18, 2016

From @dcollinsn

On Mon Jul 18 12​:57​:18 2016, Stromeko@​nexgo.de wrote​:

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

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

No branches or pull requests

2 participants