bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

2.2.3pre1: FE_INVALID problem on no-fpu CPUs. (Patch)


From: Mark Hatle
Subject: 2.2.3pre1: FE_INVALID problem on no-fpu CPUs. (Patch)
Date: Thu, 05 Apr 2001 19:33:03 -0700

While compiling 2.2.3pre1 for a non floating point machine (with the
--without-fpu option in configure) I got a compile error:

ppc_8xx-gcc ../sysdeps/generic/e_scalb.c -c -O2 -Wall -Winline
-Wstrict-prototypes -Wwrite-strings -mnew-mnemonics -Wa,-mppc
-mpowerpc   -fpic   -Wno-unin$../sysdeps/generic/e_scalb.c: In function
`__ieee754_scalb':
../sysdeps/generic/e_scalb.c:53: `FE_INVALID' undeclared (first use in
this function)
../sysdeps/generic/e_scalb.c:53: (Each undeclared identifier is reported
only once
../sysdeps/generic/e_scalb.c:53: for each function it appears in.)  

Basically I tracked the problem down to:

2001-02-19  Ulrich Drepper  <address@hidden>

        * sysdeps/generic/e_scalb.c: Set invalid exception for invalid
        parameters.
        * sysdeps/generic/e_scalbf.c: Likewise.
        * sysdeps/generic/e_scalbl.c: Likewise.

I fixed it with the attached patch.  (Basically wrapping the FE_INVALID
usage with #ifdef/#endif.)  I found another instance somewhere else in
glibc of this behavior so I believe it is correct.

Let me know if you have any comments on this.

Thanx!
--Mark Hatle
MontaVista Software, Inc.
diff -ur glibc-2.2.3.orig/sysdeps/generic/e_scalb.c 
glibc-2.2.3/sysdeps/generic/e_scalb.c
--- glibc-2.2.3.orig/sysdeps/generic/e_scalb.c  Mon Mar 26 20:53:13 2001
+++ glibc-2.2.3/sysdeps/generic/e_scalb.c       Thu Apr  5 18:37:46 2001
@@ -50,14 +50,18 @@
              return x;
            else if (!__finite (x))
              {
+               #ifdef FE_INVALID
                feraiseexcept (FE_INVALID);
+               #endif
                return __nan ("");
              }
            else       return x/(-fn);
        }
        if (__rint(fn)!=fn)
          {
+           #ifdef FE_INVALID
            feraiseexcept (FE_INVALID);
+           #endif
            return __nan ("");
          }
        if ( fn > 65000.0) return __scalbn(x, 65000);
diff -ur glibc-2.2.3.orig/sysdeps/generic/e_scalbf.c 
glibc-2.2.3/sysdeps/generic/e_scalbf.c
--- glibc-2.2.3.orig/sysdeps/generic/e_scalbf.c Mon Mar 26 20:53:13 2001
+++ glibc-2.2.3/sysdeps/generic/e_scalbf.c      Thu Apr  5 18:38:23 2001
@@ -47,14 +47,18 @@
              return x;
            else if (!__finitef (x))
              {
+               #ifdef FE_INVALID
                feraiseexcept (FE_INVALID);
+               #endif
                return __nanf ("");
              }
            else       return x/(-fn);
        }
        if (__rintf(fn)!=fn)
          {
+           #ifdef FE_INVALID
            feraiseexcept (FE_INVALID);
+           #endif
            return __nanf ("");
          }
        if ( fn > (float)65000.0) return __scalbnf(x, 65000);
diff -ur glibc-2.2.3.orig/sysdeps/generic/e_scalbl.c 
glibc-2.2.3/sysdeps/generic/e_scalbl.c
--- glibc-2.2.3.orig/sysdeps/generic/e_scalbl.c Mon Mar 26 20:53:13 2001
+++ glibc-2.2.3/sysdeps/generic/e_scalbl.c      Thu Apr  5 18:39:07 2001
@@ -54,14 +54,18 @@
              return x;
            else if (!__finitel (x))
              {
+               #ifdef FE_INVALID
                feraiseexcept (FE_INVALID);
+               #endif
                return __nanl ("");
              }
            else       return x/(-fn);
        }
        if (__rintl(fn)!=fn)
          {
+           #ifdef FE_INVALID
            feraiseexcept (FE_INVALID);
+           #endif
            return __nanl ("");
          }
        if ( fn > 65000.0) return __scalbnl(x, 65000);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]