[Bug math/22690] [ldbl-128ibm] lrintl, lroundl missing "invalid" exceptions
cvs-commit at gcc dot gnu.org
sourceware-bugzilla@sourceware.org
Wed Jan 10 00:03:00 GMT 2018
https://sourceware.org/bugzilla/show_bug.cgi?id=22690
--- 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 1272748886257ae4d73485eb7534756e89643091 (commit)
from b2584ac2a4d3d5ba7da01a52e6bbc495d61974c8 (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=1272748886257ae4d73485eb7534756e89643091
commit 1272748886257ae4d73485eb7534756e89643091
Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed Jan 10 00:02:35 2018 +0000
Fix ldbl-128ibm lrintl, lroundl missing "invalid" exceptions (bug 22690).
The ldbl-128ibm implementations of lrintl and lroundl are missing
"invalid" exceptions for certain overflow cases when compiled with GCC
8. The cause of this is after-the-fact integer overflow checks that
fail when the compiler optimizes on the basis of integer overflow
being undefined; GCC 8 must be able to detect new cases of
undefinedness here.
Failure: lrint (-0x80000001p0): Exception "Invalid operation" not set
Failure: lrint_downward (-0x80000001p0): Exception "Invalid operation" not
set
Failure: lrint_towardzero (-0x80000001p0): Exception "Invalid operation"
not set
Failure: lrint_upward (-0x80000001p0): Exception "Invalid operation" not
set
Failure: lround (-0x80000001p0): Exception "Invalid operation" not set
Failure: lround_downward (-0x80000001p0): Exception "Invalid operation" not
set
Failure: lround_towardzero (-0x80000001p0): Exception "Invalid operation"
not set
Failure: lround_upward (-0x80000001p0): Exception "Invalid operation" not
set
(Tested that these failures occur before the patch for powerpc
soft-float, but the issue applies in principle for hard-float as well,
whether or not the particular optimizations in fact occur there at
present.)
This patch fixes the bug by ensuring the additions / subtractions in
question cast arguments to unsigned long int, or use 1UL as a constant
argument, so that the arithmetic occurs in an unsigned type with the
result then converted back to a signed type.
Tested for powerpc (soft-float).
[BZ #22690]
* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c (__lrintl): Use unsigned
long int for arguments of possibly overflowing addition or
subtraction.
* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c (__lroundl): Likewise.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 8 ++++++++
sysdeps/ieee754/ldbl-128ibm/s_lrintl.c | 14 +++++++-------
sysdeps/ieee754/ldbl-128ibm/s_lroundl.c | 10 +++++-----
3 files changed, 20 insertions(+), 12 deletions(-)
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list