diff options
author | Joseph Myers <joseph@codesourcery.com> | 2018-01-10 00:02:35 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2018-01-10 00:02:35 +0000 |
commit | 1272748886257ae4d73485eb7534756e89643091 (patch) | |
tree | 31254b75a5c65e74e76e7c908cac47519e50576d /string/memmove.c | |
parent | b2584ac2a4d3d5ba7da01a52e6bbc495d61974c8 (diff) | |
download | glibc-1272748886257ae4d73485eb7534756e89643091.tar glibc-1272748886257ae4d73485eb7534756e89643091.tar.gz glibc-1272748886257ae4d73485eb7534756e89643091.tar.bz2 glibc-1272748886257ae4d73485eb7534756e89643091.zip |
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.
Diffstat (limited to 'string/memmove.c')
0 files changed, 0 insertions, 0 deletions