public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/15268] New: Default SET_RESTORE_ROUND implementation hold exceptions
@ 2013-03-11 13:35 azanella at linux dot vnet.ibm.com
  2013-03-11 20:04 ` [Bug math/15268] " azanella at linux dot vnet.ibm.com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: azanella at linux dot vnet.ibm.com @ 2013-03-11 13:35 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/15268] Default SET_RESTORE_ROUND implementation hold exceptions
  2013-03-11 13:35 [Bug math/15268] New: Default SET_RESTORE_ROUND implementation hold exceptions azanella at linux dot vnet.ibm.com
@ 2013-03-11 20:04 ` azanella at linux dot vnet.ibm.com
  2013-12-03  0:36 ` [Bug math/15268] exp (-7.4444006192138124e+02) missing underflow jsm28 at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: azanella at linux dot vnet.ibm.com @ 2013-03-11 20:04 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from Adhemerval Zanella Netto <azanella at linux dot vnet.ibm.com> 2013-03-11 20:04:10 UTC ---
Created attachment 6928
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6928
testcase for the bug

To build:

$ gcc exp_testcase.c -lm

Run to check the output:

$ ./a.out 
exp (-7.444400619213812433372368e+02) = 4.940656458412465441765688e-324

Check exception generation:

$ SETEXCEPT=1 ./a.out 
Floating point exception (core dumped)

On PPC the FP exception does not occur.

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/15268] exp (-7.4444006192138124e+02) missing underflow
  2013-03-11 13:35 [Bug math/15268] New: Default SET_RESTORE_ROUND implementation hold exceptions azanella at linux dot vnet.ibm.com
  2013-03-11 20:04 ` [Bug math/15268] " azanella at linux dot vnet.ibm.com
@ 2013-12-03  0:36 ` jsm28 at gcc dot gnu.org
  2013-12-03 21:50 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2013-12-03  0:36 UTC (permalink / raw)
  To: glibc-bugs

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

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Default SET_RESTORE_ROUND   |exp
                   |implementation hold         |(-7.4444006192138124e+02)
                   |exceptions                  |missing underflow

--- Comment #2 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
I don't see that there's a bug in SET_RESTORE_ROUND here; libc_feresetround
calls feupdateenv which should cause any exceptions that were raised after
SET_RESTORE_ROUND to generate corresponding traps.  It looks like the exp call
only generates exact underflow but not inexact, even though this is a case of
an inexact result; that's a bug in exp (and applies on x86_64 as well).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/15268] exp (-7.4444006192138124e+02) missing underflow
  2013-03-11 13:35 [Bug math/15268] New: Default SET_RESTORE_ROUND implementation hold exceptions azanella at linux dot vnet.ibm.com
  2013-03-11 20:04 ` [Bug math/15268] " azanella at linux dot vnet.ibm.com
  2013-12-03  0:36 ` [Bug math/15268] exp (-7.4444006192138124e+02) missing underflow jsm28 at gcc dot gnu.org
@ 2013-12-03 21:50 ` cvs-commit at gcc dot gnu.org
  2013-12-03 21:51 ` jsm28 at gcc dot gnu.org
  2014-06-13 10:10 ` fweimer at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2013-12-03 21:50 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  749008ff0361297af02b8574ac8848d35436eac3 (commit)
      from  17dea1887fcc116941e07cb0f5f2078140ab0384 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=749008ff0361297af02b8574ac8848d35436eac3

commit 749008ff0361297af02b8574ac8848d35436eac3
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Tue Dec 3 21:49:56 2013 +0000

    Fix exp missing underflows (bug 15268, bug 15425).

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                         |   10 ++
 NEWS                              |   20 ++--
 math/auto-libm-test-in            |    2 +
 math/auto-libm-test-out           |  214 +++++++++++++++++++++++++++++++++++++
 sysdeps/i386/fpu/libm-test-ulps   |   32 ++++++
 sysdeps/ieee754/dbl-64/e_exp.c    |   17 +++-
 sysdeps/x86_64/fpu/libm-test-ulps |   52 +++++++++
 7 files changed, 334 insertions(+), 13 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/15268] exp (-7.4444006192138124e+02) missing underflow
  2013-03-11 13:35 [Bug math/15268] New: Default SET_RESTORE_ROUND implementation hold exceptions azanella at linux dot vnet.ibm.com
                   ` (2 preceding siblings ...)
  2013-12-03 21:50 ` cvs-commit at gcc dot gnu.org
@ 2013-12-03 21:51 ` jsm28 at gcc dot gnu.org
  2014-06-13 10:10 ` fweimer at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2013-12-03 21:51 UTC (permalink / raw)
  To: glibc-bugs

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

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
Fixed for 2.19.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug math/15268] exp (-7.4444006192138124e+02) missing underflow
  2013-03-11 13:35 [Bug math/15268] New: Default SET_RESTORE_ROUND implementation hold exceptions azanella at linux dot vnet.ibm.com
                   ` (3 preceding siblings ...)
  2013-12-03 21:51 ` jsm28 at gcc dot gnu.org
@ 2014-06-13 10:10 ` fweimer at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 10:10 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-13 10:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-11 13:35 [Bug math/15268] New: Default SET_RESTORE_ROUND implementation hold exceptions azanella at linux dot vnet.ibm.com
2013-03-11 20:04 ` [Bug math/15268] " azanella at linux dot vnet.ibm.com
2013-12-03  0:36 ` [Bug math/15268] exp (-7.4444006192138124e+02) missing underflow jsm28 at gcc dot gnu.org
2013-12-03 21:50 ` cvs-commit at gcc dot gnu.org
2013-12-03 21:51 ` jsm28 at gcc dot gnu.org
2014-06-13 10:10 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).