This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/19088] lround, llround missing exceptions close to overflow threshold
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 07 Oct 2015 23:46:22 +0000
- Subject: [Bug math/19088] lround, llround missing exceptions close to overflow threshold
- Auto-submitted: auto-generated
- References: <bug-19088-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=19088
--- Comment #1 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 8afdb7ac1ecadf82abdb16a5fcfadf9537ca3d84 (commit)
from 939e092a9e46e6a8bb3d7dc3cf165f384b598f46 (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=8afdb7ac1ecadf82abdb16a5fcfadf9537ca3d84
commit 8afdb7ac1ecadf82abdb16a5fcfadf9537ca3d84
Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed Oct 7 23:45:29 2015 +0000
Fix lround, llround missing exceptions close to overflow threshold (bug
19088).
The dbl-64, ldbl-96 and ldbl-128 implementations of lround and llround
fail to produce "invalid" exceptions in cases where the rounded result
overflows the target type, but truncating the floating-point argument
to the next integer towards zero does not overflow it (so in
particular casts do not produce such exceptions). (This issue cannot
arise for float, or for double with 64-bit target type, or for ldbl-96
with 64-bit target type and negative arguments, because of
insufficient precision in the floating-point type for arguments with
the relevant property to exist.)
This patch fixes these problems by inserting checks for the special
cases that can occur in each implementation, and explicitly raising
FE_INVALID (and avoiding the cast if it might raise spurious
FE_INEXACT).
Tested for x86_64, x86 and mips64.
[BZ #19088]
* sysdeps/ieee754/dbl-64/s_lround.c: Include <fenv.h> and
<limits.h>.
(__lround) [FE_INVALID]: Force FE_INVALID exception when result
overflows but exception would not result from cast.
* sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Include <fenv.h>
and <limits.h>.
(__lround) [FE_INVALID]: Force FE_INVALID exception when result
overflows but exception would not result from cast.
* sysdeps/ieee754/ldbl-128/s_llroundl.c: Include <fenv.h> and
<limits.h>.
(__llroundl) [FE_INVALID]: Force FE_INVALID exception when result
overflows but exception would not result from cast.
* sysdeps/ieee754/ldbl-128/s_lroundl.c: Include <fenv.h> and
<limits.h>.
(__lroundl) [FE_INVALID]: Force FE_INVALID exception when result
overflows but exception would not result from cast.
* sysdeps/ieee754/ldbl-96/s_llroundl.c: Include <fenv.h> and
<limits.h>.
(__llroundl) [FE_INVALID]: Force FE_INVALID exception when result
overflows but exception would not result from cast.
* sysdeps/ieee754/ldbl-96/s_lroundl.c: Include <fenv.h> and
<limits.h>.
(__lroundl) [FE_INVALID]: Force FE_INVALID exception when result
overflows but exception would not result from cast.
* math/libm-test.inc (lround_test_data): Add more tests.
(llround_test_data): Likewise.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 30 ++++
NEWS | 2 +-
math/libm-test.inc | 185 +++++++++++++++++++++++++
sysdeps/ieee754/dbl-64/s_lround.c | 28 ++++-
sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c | 24 +++-
sysdeps/ieee754/ldbl-128/s_llroundl.c | 25 +++-
sysdeps/ieee754/ldbl-128/s_lroundl.c | 32 ++++-
sysdeps/ieee754/ldbl-96/s_llroundl.c | 11 ++-
sysdeps/ieee754/ldbl-96/s_lroundl.c | 35 +++++-
9 files changed, 358 insertions(+), 14 deletions(-)
--
You are receiving this mail because:
You are on the CC list for the bug.