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

-Dusequadmath test failures on Ubuntu 12.04 gcc 4.6 #14761

Open
p5pRT opened this issue Jun 16, 2015 · 13 comments
Open

-Dusequadmath test failures on Ubuntu 12.04 gcc 4.6 #14761

p5pRT opened this issue Jun 16, 2015 · 13 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 16, 2015

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

Searchable as RT125423$

@p5pRT
Copy link
Author

p5pRT commented Jun 16, 2015

From @ilmari

Trying to build a quadmath perl on my aging Ubuntu workstation, I got a
couple of test failures.

t/./op/infnan ... # Failed test 316 - sqrt(+Inf) is +Inf at
./op/infnan.t line 210
# got "NaN"
# expected "Inf"
FAILED at test 316
Failed 1 test out of 0, 0.00% okay.
  ./op/infnan.t

t/../ext/POSIX/t/math ... # Failed test 'cbrt'
# at t/math.t line 69.
# '2.37003588972758662004814342820421'
# <
# '1e-09'
# Looks like you failed 1 test of 136.
FAILED at test 58
Failed 1 test out of 0, 0.00% okay.
  ../ext/POSIX/t/math.t

perl -V output​:

Summary of my perl5 (revision 5 version 23 subversion 0) configuration​:
  Commit id​: 4b95171
  Platform​:
  osname=linux, osvers=3.2.0-80-generic, archname=x86_64-linux-quadmath
  uname='linux zarquon 3.2.0-80-generic #116-ubuntu smp mon mar 23 17​:11​:03 utc 2015 x86_64 x86_64 x86_64 gnulinux '
  config_args='-des -Dusedevel -Uversiononly -Dusequadmath'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O2',
  cppflags='-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=12345678, doublekind=3
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
  ivtype='long', ivsize=8, nvtype='__float128', nvsize=16, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
  libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat -lquadmath
  perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc -lquadmath
  libc=libc-2.15.so, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version='2.15'
  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'

Characteristics of this binary (from libperl)​:
  Compile-time options​: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
  PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
  PERL_NEW_COPY_ON_WRITE 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_PERLIO USE_PERL_ATOF USE_QUADMATH
  Built under linux
  Compiled at Jun 16 2015 14​:27​:58
  %ENV​:
  PERLBREW="command perlbrew"
  PERLBREW_BASHRC_VERSION="0.73"
  PERLBREW_HOME="/home/ilmari/.perlbrew"
  PERLBREW_PATH="/home/ilmari/perl5/perlbrew/bin"
  PERLBREW_ROOT="/home/ilmari/perl5/perlbrew"
  PERLBREW_VERSION="0.73"
  PERLDOC_PAGER="less -iR"
  @​INC​:
  lib
  /usr/local/lib/perl5/site_perl/5.23.0/x86_64-linux-quadmath
  /usr/local/lib/perl5/site_perl/5.23.0
  /usr/local/lib/perl5/5.23.0/x86_64-linux-quadmath
  /usr/local/lib/perl5/5.23.0
  .

--
"i use RMS as a guide in the same way that a boat captain would use
a lighthouse. It's good to know where it is, but you generally
don't want to find yourself in the same spot." - Tollef Fog Heen

@p5pRT
Copy link
Author

p5pRT commented Jun 16, 2015

From @ilmari

Trying to build a quadmath perl on my aging Ubuntu workstation, I got a
couple of test failures.

These turn out to be bugs in this version of libquadmath​:

ilmari@​zarquon​:~/src/perl$ cat cbrt.c
#include <quadmath.h>
#include <stdio.h>

int main (int argc, char **argv) {
  char buf[100];
  size_t remaining = sizeof buf;
  size_t offset = quadmath_snprintf(buf, remaining, "%Qg", cbrtq(-27));
  *(buf + offset++) = ' ';
  remaining -= offset;
  quadmath_snprintf(buf+offset, remaining, "%Qg", sqrtq(1.0Q/0.0Q));
  printf("%s\n", buf);
  exit(0);
}
ilmari@​zarquon​:~/src/perl$ gcc cbrt.c -o cbrt -lquadmath && ./cbrt
-0.629964 -nan

t/./op/infnan ... # Failed test 316 - sqrt(+Inf) is +Inf at
./op/infnan.t line 210
# got "NaN"
# expected "Inf"
FAILED at test 316
Failed 1 test out of 0, 0.00% okay.
./op/infnan.t

t/../ext/POSIX/t/math ... # Failed test 'cbrt'
# at t/math.t line 69.
# '2.37003588972758662004814342820421'
# <
# '1e-09'
# Looks like you failed 1 test of 136.
FAILED at test 58
Failed 1 test out of 0, 0.00% okay.
../ext/POSIX/t/math.t

perl -V output​:

Summary of my perl5 (revision 5 version 23 subversion 0) configuration​:
Commit id​: 4b95171
Platform​:
osname=linux, osvers=3.2.0-80-generic, archname=x86_64-linux-quadmath
uname='linux zarquon 3.2.0-80-generic #116-ubuntu smp mon mar 23 17​:11​:03 utc 2015 x86_64 x86_64 x86_64 gnulinux '
config_args='-des -Dusedevel -Uversiononly -Dusequadmath'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler​:
cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-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=12345678, doublekind=3
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
ivtype='long', ivsize=8, nvtype='__float128', nvsize=16, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries​:
ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat -lquadmath
perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc -lquadmath
libc=libc-2.15.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.15'
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'

Characteristics of this binary (from libperl)​:
Compile-time options​: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
PERL_NEW_COPY_ON_WRITE 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_PERLIO USE_PERL_ATOF USE_QUADMATH
Built under linux
Compiled at Jun 16 2015 14​:27​:58
%ENV​:
PERLBREW="command perlbrew"
PERLBREW_BASHRC_VERSION="0.73"
PERLBREW_HOME="/home/ilmari/.perlbrew"
PERLBREW_PATH="/home/ilmari/perl5/perlbrew/bin"
PERLBREW_ROOT="/home/ilmari/perl5/perlbrew"
PERLBREW_VERSION="0.73"
PERLDOC_PAGER="less -iR"
@​INC​:
lib
/usr/local/lib/perl5/site_perl/5.23.0/x86_64-linux-quadmath
/usr/local/lib/perl5/site_perl/5.23.0
/usr/local/lib/perl5/5.23.0/x86_64-linux-quadmath
/usr/local/lib/perl5/5.23.0
.

--
- Twitter seems more influential [than blogs] in the 'gets reported in
  the mainstream press' sense at least. - Matt McLeod
- That'd be because the content of a tweet is easier to condense down
  to a mainstream media article. - Calle Dybedahl

@p5pRT
Copy link
Author

p5pRT commented Jun 16, 2015

From @jkeenan

On Tue Jun 16 10​:20​:56 2015, ilmari wrote​:

Trying to build a quadmath perl on my aging Ubuntu workstation, I got
a
couple of test failures.

These turn out to be bugs in this version of libquadmath​:

ilmari@​zarquon​:~/src/perl$ cat cbrt.c
#include <quadmath.h>
#include <stdio.h>

int main (int argc, char **argv) {
char buf[100];
size_t remaining = sizeof buf;
size_t offset = quadmath_snprintf(buf, remaining, "%Qg", cbrtq(-
27));
*(buf + offset++) = ' ';
remaining -= offset;
quadmath_snprintf(buf+offset, remaining, "%Qg", sqrtq(1.0Q/0.0Q));
printf("%s\n", buf);
exit(0);
}
ilmari@​zarquon​:~/src/perl$ gcc cbrt.c -o cbrt -lquadmath && ./cbrt
-0.629964 -nan

t/./op/infnan ... # Failed test 316 - sqrt(+Inf) is +Inf at
./op/infnan.t line 210
# got "NaN"
# expected "Inf"
FAILED at test 316
Failed 1 test out of 0, 0.00% okay.
./op/infnan.t

t/../ext/POSIX/t/math ... # Failed test 'cbrt'
# at t/math.t line 69.
# '2.37003588972758662004814342820421'
# <
# '1e-09'
# Looks like you failed 1 test of 136.
FAILED at test 58
Failed 1 test out of 0, 0.00% okay.
../ext/POSIX/t/math.t

Yes, I believe this is version-specific. On Ubuntu 14.04 LTS, when I build blead perl all tests pass. (See attached for perl -V output.)

And when I compile and run the C program you provided, I get​:

#####
$ ./cbrt
-3 inf
#####

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jun 16, 2015

From @jkeenan

Summary of my perl5 (revision 5 version 23 subversion 0) configuration​:
  Commit id​: bace499
  Platform​:
  osname=linux, osvers=3.13.0-54-generic, archname=x86_64-linux-quadmath
  uname='linux zareason 3.13.0-54-generic #91-ubuntu smp tue may 26 19​:15​:08 utc 2015 x86_64 x86_64 x86_64 gnulinux '
  config_args='-des -Dusedevel -Dusequadmath'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O2',
  cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.8.2', 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='__float128', nvsize=16, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64
  libs=-lpthread -lnsl -ldb -ldl -lm -lcrypt -lutil -lc -lquadmath
  perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc -lquadmath
  libc=libc-2.19.so, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version='2.19'
  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'

Characteristics of this binary (from libperl)​:
  Compile-time options​: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
  PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
  PERL_NEW_COPY_ON_WRITE 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_PERLIO USE_PERL_ATOF USE_QUADMATH
  Built under linux
  Compiled at Jun 16 2015 18​:20​:08
  %ENV​:
  PERLBREW_BASHRC_VERSION="0.67"
  PERLBREW_HOME="/home/jkeenan/.perlbrew"
  PERLBREW_MANPATH="/home/jkeenan/perl5/perlbrew/perls/perl-5.22.0/man"
  PERLBREW_PATH="/home/jkeenan/perl5/perlbrew/bin​:/home/jkeenan/perl5/perlbrew/perls/perl-5.22.0/bin"
  PERLBREW_PERL="perl-5.22.0"
  PERLBREW_ROOT="/home/jkeenan/perl5/perlbrew"
  PERLBREW_VERSION="0.67"
  PERL_WORKDIR="gitwork/perl"
  @​INC​:
  lib
  /usr/local/lib/perl5/site_perl/5.23.0/x86_64-linux-quadmath
  /usr/local/lib/perl5/site_perl/5.23.0
  /usr/local/lib/perl5/5.23.0/x86_64-linux-quadmath
  /usr/local/lib/perl5/5.23.0
  .

@p5pRT
Copy link
Author

p5pRT commented Jun 16, 2015

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

@p5pRT
Copy link
Author

p5pRT commented Jun 16, 2015

From @ilmari

"James E Keenan via RT" <perlbug-followup@​perl.org> writes​:

Yes, I believe this is version-specific. On Ubuntu 14.04 LTS, when I
build blead perl all tests pass. (See attached for perl -V output.)

alh and vincent helped me narrow down the versions a bit, and it seems
that quadmath is broken on gcc < 4.8.

  < alh> Weird, works here
  < ilmari> which os/gcc?
  < alh> gcc version 4.9.1 (Ubuntu 4.9.1-16ubuntu6)
  < alh> Ubuntu 14.10
  < ilmari> ah, I'm on 12.04
  < ilmari> gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
  < alh> Also works on gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) (14.04)
  < vincent> I also get -0.629964 -nan on debian wheezy with gcc 4.7.2
  < alh> I can reproduce on my 12.04 as well
  < ilmari> so looks like quadmath is broken on gcc < 4.8

Additionally it worked for me with both gcc 4.9 and 5.1 on Debian
testing.

Unless someone particularly wants to explicitly disable building with
quadmath on (or figure out a workaround for) the broken gcc versions, I
suggest closing this ticket as not a bug in perl.

--
"I use RMS as a guide in the same way that a boat captain would use
a lighthouse. It's good to know where it is, but you generally
don't want to find yourself in the same spot." - Tollef Fog Heen

@p5pRT
Copy link
Author

p5pRT commented Jun 17, 2015

From zefram@fysh.org

Dagfinn Ilmari Mannsaker wrote​:

Unless someone particularly wants to explicitly disable building with
quadmath on (or figure out a workaround for) the broken gcc versions,

I think it would be worth adding a configure probe, along the lines of the
cbrt(-3)/sqrt(inf) test program, to check whether quadmath is (at least
superficially) working. If we don't do that, the bug report will recur.

-zefram

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2015

From @jkeenan

On Wed Jun 17 04​:46​:11 2015, zefram@​fysh.org wrote​:

Dagfinn Ilmari Mannsaker wrote​:

Unless someone particularly wants to explicitly disable building with
quadmath on (or figure out a workaround for) the broken gcc versions,

I think it would be worth adding a configure probe, along the lines of the
cbrt(-3)/sqrt(inf) test program, to check whether quadmath is (at least
superficially) working. If we don't do that, the bug report will recur.

-zefram

In blead (772a2be), I see code starting at line 16553 which appears to check for the presence of quadmath.

If that's correct, then how does that affect the status of this ticket?

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Dec 10, 2015

From @ilmari

"James E Keenan via RT" <perlbug-followup@​perl.org> writes​:

On Wed Jun 17 04​:46​:11 2015, zefram@​fysh.org wrote​:

Dagfinn Ilmari Mannsaker wrote​:

Unless someone particularly wants to explicitly disable building with
quadmath on (or figure out a workaround for) the broken gcc versions,

I think it would be worth adding a configure probe, along the lines of the
cbrt(-3)/sqrt(inf) test program, to check whether quadmath is (at least
superficially) working. If we don't do that, the bug report will recur.

-zefram

In blead (772a2be), I see code
starting at line 16553 which appears to check for the presence of
quadmath.

If that's correct, then how does that affect the status of this ticket?

That merely checks for the presence of the header, there are no tests
for the correctness of quadruple-precision calculations.

--
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen

@p5pRT
Copy link
Author

p5pRT commented Aug 20, 2019

From @jkeenan

On Thu, 10 Dec 2015 11​:17​:43 GMT, ilmari wrote​:

"James E Keenan via RT" <perlbug-followup@​perl.org> writes​:

On Wed Jun 17 04​:46​:11 2015, zefram@​fysh.org wrote​:

Dagfinn Ilmari Mannsaker wrote​:

Unless someone particularly wants to explicitly disable building
with
quadmath on (or figure out a workaround for) the broken gcc
versions,

I think it would be worth adding a configure probe, along the lines
of the
cbrt(-3)/sqrt(inf) test program, to check whether quadmath is (at
least
superficially) working. If we don't do that, the bug report will
recur.

-zefram

In blead (772a2be), I see code
starting at line 16553 which appears to check for the presence of
quadmath.

If that's correct, then how does that affect the status of this
ticket?

That merely checks for the presence of the header, there are no tests
for the correctness of quadruple-precision calculations.

Can anyone provide a patch for Configure that would implement the test of the correctness of quadruple-precision calculations as discussed in this ticket?

Thank you very much.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Aug 21, 2019

From @sisyphus

On Tue, 20 Aug 2019 06​:15​:24 -0700, jkeenan wrote​:

Can anyone provide a patch for Configure that would implement the test
of the correctness of quadruple-precision calculations as discussed in
this ticket?

Thank you very much.

Would it be sufficient to just skip or todo the offending tests if $Config{gccversion} is defined && lt '4.8.0' ?

If was established during Configure that cbrt() of -ve numbers and sqrt(Inf) was buggy, what would we do with that information anyway ?

Cheers,
Rob

@p5pRT
Copy link
Author

p5pRT commented Aug 21, 2019

From @sisyphus

On Tue, 20 Aug 2019 17​:47​:22 -0700, sisyphus@​cpan.org wrote​:

$Config{gccversion} is defined && lt '4.8.0'

&& $Config{usequadmath} is also defined, of course.

Cheers,
Rob

@p5pRT
Copy link
Author

p5pRT commented Aug 21, 2019

From @doughera88

On Tue, Aug 20, 2019 at 05​:47​:22PM -0700, sisyphus@​cpan.org via RT wrote​:

On Tue, 20 Aug 2019 06​:15​:24 -0700, jkeenan wrote​:

Can anyone provide a patch for Configure that would implement the test
of the correctness of quadruple-precision calculations as discussed in
this ticket?

Thank you very much.

Would it be sufficient to just skip or todo the offending tests if $Config{gccversion} is defined && lt '4.8.0' ?

I don't like sweeping failures under the rug that way. The tests are showing
problems with the chosen configuration on the particular platform.
If the user wants to use that build anyway, I think they should be able to, but
should be aware of the test problems.

If was established during Configure that cbrt() of -ve numbers and sqrt(Inf) was buggy, what would we do with that information anyway ?

We could abort and forbid that configuration from completing. My preference
is to not be so rigid.

--
  Andy Dougherty doughera@​lafayette.edu

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

No branches or pull requests

2 participants