This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/15268] New: Default SET_RESTORE_ROUND implementation hold exceptions


http://sourceware.org/bugzilla/show_bug.cgi?id=15268

             Bug #: 15268
           Summary: Default SET_RESTORE_ROUND implementation hold
                    exceptions
           Product: glibc
           Version: 2.18
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: unassigned@sourceware.org
        ReportedBy: azanella@linux.vnet.ibm.com
    Classification: Unclassified


While debugging why exp (-7.4444006192138124e+02) does *not* generate an
underflow exception on PowerPC and does on i32/x86_64 I found the issue
is related on how the rounding mode is being set on the two architectures.

The rounding mode is set using the macro SET_RESTORE_ROUND:

#define SET_RESTORE_ROUND(RM) \
  fenv_t __libc_save_rm __attribute__((cleanup(libc_feresetround)));    \
  libc_feholdsetround (&__libc_save_rm, (RM))

And libc_feresetround and libc_feholdsetround could be redefined depending
on the architecture. For SSE2 or higher on i32/x86_64 it will be redefined
to libc_feresetround_sse and this function only sets the rounding mode,
not changing any behavior on how the FP exception are being generated.

The issue is for PowerPC the default implementation
default_libc_feholdexcept_setround 
is being used and the function set the rounding mode *and* hold any FP
exception. This make the exp underflow exception to be generate but ignored
on PowerPC.

So SET_RESTORE_ROUND generic implementation does not really follow
what it proposes: I believe the correct implementation would be *just* set
the rounding mode and not touch any FP exceptions behavior. The macro
SET_RESTORE_ROUND_NOEX handles the case where FP exception may be ignored.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]