[llvm-bugs] [Bug 49131] New: __gcc_qadd produces spurious infinity
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Feb 10 14:33:34 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49131
Bug ID: 49131
Summary: __gcc_qadd produces spurious infinity
Product: compiler-rt
Version: 11.0
Hardware: Other
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: compiler-rt
Assignee: unassignedbugs at nondot.org
Reporter: bbaren at google.com
CC: llvm-bugs at lists.llvm.org
Created attachment 24511
--> https://bugs.llvm.org/attachment.cgi?id=24511&action=edit
minimal example
__gcc_qadd, which adds two double-double long doubles on POWER, can incorrectly
return infinity instead of a finite result:
$ cat ldbl.c
extern int printf(const char* restrict, ...);
int main() {
long double a = -0x1.1e282e024debdb875f47f6c85p+1021L;
printf("%Le\n", a + 0x1.fffffffffffff7ffffffffffff8p+1023L);
}
$ clang -Wall -Wextra -O0 -rtlib=compiler-rt -o ldbl ldbl.c
$ ./ldbl
inf
The two operands in this case are approximately -2.5e+307 and 1.8e+308; each
has a valid and finite double-double representation, and adding them should
produce another finite one. (In this case, the correct answer is about
1.5+308.)
I originally discovered this using Debian’s clang 11.0.1-2, but it’s also
present in non-Debian builds.
GCC produces the correct answer for this computation, though only when
optimizations are enabled (see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99048).
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210210/f34ab29e/attachment.html>
More information about the llvm-bugs
mailing list