hppa-unknown-linux-gnu

configured with: ../src/configure -v
--enable-languages=c,c++,java,fortran,objc,obj-c++,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
+--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-awt=gtk
+--enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/jre --enable-mpfr
--enable-checking=release hppa-linux-gnu 

Hi all,


Trying to debug glibc test-float failures on linux parisc, it appears that a
place where one pb occures was during:

__real__ res = (float) M_PI_2 - __real__ y; //(1)

of '__cacosf (__complex__ float x);'

where __real__ y == nan;

The glibc test was failing because resulting of computation (1) is a
_signaling_ nan: the fpsr v bit (i.e. Invalid operation) is set.

Afaik this occures because __real__ y is itself a _signaling_ nan?

And this came from imho casinf() computation hunk:
[snip]
else if (__isinff (__real__ x) || __isinff (__imag__ x))
{
__real__ res = __nanf ("");
__imag__ res = __copysignf (HUGE_VALF, __imag__ x);
}
[snip]

It seems so that __nanf (""), precompiled as __builtin_nanf(""), return a
signaling nan.

I will attach a precompile file of this simple test case:

#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif

#include <math.h>
#include <float.h>
#include <limits.h>

#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

static float
L_nanf (const char *tagp)
{
if (tagp[0] != '\0')
{
char buf[6 + strlen (tagp)];
sprintf (buf, "NAN(%s)", tagp);
return strtof (buf, NULL);
}

printf ("tagp[0] == '\\0'\n");
return NAN;
}

int
main (int argc, char **argv)
{

union { unsigned long long l; unsigned int sw[2]; } s;

float res, tst;

res = L_nanf ("");
//printf ("res: 0x%x\n", (int)res);

tst = 4.0 - res;

__asm__("#BannerIn");
/* Get the current status word. */
__asm__ ("\n\t"
"fstd %%fr0,0(%1)"
: "=m" (s.l)
: "r" (&s.l)
);

printf ("s.sw[0]: 0x%x.\n", s.sw[0]);
printf ("s.sw[0] >> 27: 0x%x.\n", (s.sw[0] >> 27));

__asm__("#BannerOut");

return (int)tst;
}

reporting well:


tagp[0] == '\0'
s.sw[0]: 0x80000000.
s.sw[0] >> 27: 0x10.

Tx,
Joel

PS: compile options for test case:
gcc-4.1: warning: -pipe ignored because -save-temps specified
Using built-in specs.
Target: hppa-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,fortran,objc,obj-c++,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib --without-i
ncluded-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1
--enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/jre --enable-mpfr
--enable-checking=release hppa-linux-gnu
Thread model: posix
gcc version 4.1.1 20060511 (prerelease) (Debian 4.1.0-4)
/usr/lib/gcc/hppa-linux-gnu/4.1.1/cc1 -E -quiet -nostdinc -v -I../include -I.
-I/CAD/parisc-linux/Dpkg/dpkg-work/glibc-2.3.6/build-tree/hppa-libc/math -I..
-I../libio -I/CAD/parisc-l
inux/Dpkg/dpkg-work/glibc-2.3.6/build-tree/hppa-libc -I../sysdeps/hppa/elf
-I../libidn/sysdeps/unix -I../linuxthreads/sysdeps/unix/sysv/linux/hppa
-I../linuxthreads/sysdeps/unix/sysv/
linux -I../linuxthreads/sysdeps/pthread -I../sysdeps/pthread
-I../linuxthreads/sysdeps/unix/sysv -I../linuxthreads/sysdeps/unix
-I../linuxthreads/sysdeps/hppa -I../sysdeps/unix/sysv/l
inux/hppa -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu
-I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet
-I../sysdeps/unix/sysv -I../sysdeps/unix -I../sysdeps/po
six -I../sysdeps/hppa/hppa1.1 -I../sysdeps/wordsize-32
-I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/hppa/fpu
-I../sysdeps/hppa -I../sysdeps/ieee754 -I../sysdep
s/generic/elf -I../sysdeps/generic -MD
/CAD/parisc-linux/Dpkg/dpkg-work/glibc-2.3.6/build-tree/hppa-libc/math/Nan.d
-MF /CAD/parisc-linux/Dpkg/dpkg-work/glibc-2.3.6/build-tree/hppa-li
bc/math/Nan.o.dt -MP -MT
/CAD/parisc-linux/Dpkg/dpkg-work/glibc-2.3.6/build-tree/hppa-libc/math/Nan.o
-MQ
/CAD/parisc-linux/Dpkg/dpkg-work/glibc-2.3.6/build-tree/hppa-libc/math/Nan.o
-D__NO_MATH_INLINES -D__LIBC_INTERNAL_MATH_INLINES -DNO_LONG_DOUBLE
-D_Mlong_double_=double -D_LIBC_REENTRANT -DNOT_IN_libc=1 -isystem
/usr/lib/gcc/hppa-linux-gnu/4.1.1/include -isyst
em /CAD/parisc-linux/Dpkg/dpkg-work/glibc-2.3.6/debian/include -include
../include/libc-symbols.h Nan.c -std=gnu99 -Wall -Winline -Wstrict-prototypes
-Wwrite-strings -Wno-uninitialize
d -fstrict-aliasing -fno-inline -ffloat-store -fno-builtin -fworking-directory
-O2 -fpch-preprocess -o Nan.i
#include "..." search starts here:
#include <...> search starts here:
../include
.
/CAD/parisc-linux/Dpkg/dpkg-work/glibc-2.3.6/build-tree/hppa-libc/math
..
../libio
/CAD/parisc-linux/Dpkg/dpkg-work/glibc-2.3.6/build-tree/hppa-libc
../sysdeps/hppa/elf
../libidn/sysdeps/unix
../linuxthreads/sysdeps/unix/sysv/linux/hppa
../linuxthreads/sysdeps/unix/sysv/linux
../linuxthreads/sysdeps/pthread
../sysdeps/pthread
../linuxthreads/sysdeps/unix/sysv
../linuxthreads/sysdeps/unix
../linuxthreads/sysdeps/hppa
../sysdeps/unix/sysv/linux/hppa
../sysdeps/unix/sysv/linux
../sysdeps/gnu
../sysdeps/unix/common
../sysdeps/unix/mman
../sysdeps/unix/inet
../sysdeps/unix/sysv
../sysdeps/unix
../sysdeps/posix
../sysdeps/hppa/hppa1.1
../sysdeps/wordsize-32
../sysdeps/ieee754/flt-32
../sysdeps/ieee754/dbl-64
../sysdeps/hppa/fpu
../sysdeps/hppa
../sysdeps/ieee754
../sysdeps/generic/elf
../sysdeps/generic
/usr/lib/gcc/hppa-linux-gnu/4.1.1/include
/CAD/parisc-linux/Dpkg/dpkg-work/glibc-2.3.6/debian/include
End of search list.
/usr/lib/gcc/hppa-linux-gnu/4.1.1/cc1 -fpreprocessed Nan.i -quiet -dumpbase
Nan.c -auxbase-strip
/CAD/parisc-linux/Dpkg/dpkg-work/glibc-2.3.6/build-tree/hppa-libc/math/Nan.o
-g -O2 -
Wall -Winline -Wstrict-prototypes -Wwrite-strings -Wno-uninitialized
-std=gnu99 -version -fstrict-aliasing -fno-inline -ffloat-store -fno-builtin
-o Nan.s
GNU C version 4.1.1 20060511 (prerelease) (Debian 4.1.0-4) (hppa-linux-gnu)
compiled by GNU C version 4.1.1 20060511 (prerelease) (Debian 4.1.0-4).
GGC heuristics: --param ggc-min-expand=46 --param ggc-min-heapsize=31137
Compiler executable checksum: e86175deb88d866b27528eee26dfa969
as --traditional-format -V -o
/CAD/parisc-linux/Dpkg/dpkg-work/glibc-2.3.6/build-tree/hppa-libc/math/Nan.o
Nan.s
GNU assembler version 2.16.91 (hppa-linux-gnu) using BFD version 2.16.91
20060413 Debian GNU/Linux


-- 
           Summary: __builtin_nanf("") doesn't return a _quiet_ nan on
                    parisc
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: soete dot joel at tiscali dot be
 GCC build triplet: hppa-unknown-linux-gnu
  GCC host triplet: hppa-unknown-linux-gnu
GCC target triplet: hppa-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27627

Reply via email to