public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107967] [13 regression] The gcc commit r13-3923 caused the glibc make check fails. Date: Tue, 06 Dec 2022 15:59:49 +0000 [thread overview] Message-ID: <bug-107967-4-yVEreak9p9@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107967-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107967 --- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Ok, I can reproduce this, disabling all the +-*/ handlers fixes it. It isn libm.so.6 that matters for the failures, not the tests themselves. So far I've looked at the expm1 stuff, the failures are: Failure: expm1 (0x1.86ap+16): Exception "Overflow" not set Failure: expm1 (0x2.c5c4p+12): Exception "Overflow" not set Failure: expm1 (0xf.ffffffffffff8p+1020): Exception "Overflow" not set Failure: expm1 (0xf.fffffp+124): Exception "Overflow" not set Failure: expm1_downward (0x1.86ap+16): Exception "Overflow" not set Failure: Test: expm1_downward (0x1.86ap+16) Result: is: inf inf should be: 1.7976931348623157e+308 0x1.fffffffffffffp+1023 Failure: expm1_downward (0x2.c5c4p+12): Exception "Overflow" not set Failure: Test: expm1_downward (0x2.c5c4p+12) Result: is: inf inf should be: 1.7976931348623157e+308 0x1.fffffffffffffp+1023 ... Failure: expm1_upward (0x1.86ap+16): Exception "Overflow" not set Failure: expm1_upward (0x2.c5c4p+12): Exception "Overflow" not set Failure: expm1_upward (0xf.ffffffffffff8p+1020): Exception "Overflow" not set Failure: expm1_upward (0xf.fffffp+124): Exception "Overflow" not set For all the arguments >= 710.0 or so (non-inf/nan), the path in the source is: static const double huge = 1.0e+300, tiny = 1.0e-300, o_threshold = 7.09782712893383973096e+02; /* 0x40862E42, 0xFEFA39EF */ ... if (x > o_threshold) { __set_errno (ERANGE); return huge * huge; /* overflow */ } and the file is compiled with -frounding-math. So the reduced testcase for at least part of this PR is: double foo (void) { const double huge = 1.0e+300; return huge * huge; } GCC 12 would compile this into return __builtin_inf (); only with -fno-trapping-math, not without it nor with -frounding-math. Now, GCC trunk compiles this into return __builtin_inf (); with all of -fno-trapping-math, default or -frounding-math. For the default case, the problem is the same as in PR107608. But with -frounding-math, we have an extra problem with the value, which actually shouldn't be +INF but DBL_MAX. E.g. #include <fenv.h> #include <stdio.h> int main () { volatile double huge = 1.0e+308; volatile double inf = __builtin_inf (); fesetround (FE_DOWNWARD); volatile double r1 = huge + huge; volatile double r2 = huge * huge; volatile double r3 = huge + inf; volatile double r4 = r2 + huge; volatile double r5 = inf - 1.0; volatile double r6 = inf - huge; fesetround (FE_TONEAREST); printf ("%e %e %e %e %e %e\n", r1, r2, r3, r4, r5, r6); } prints 1.797693e+308 1.797693e+308 inf 1.797693e+308 inf inf, so the behavior seems to be if either operand is already inf, then the result should be inf even when rounding to -inf (except special cases when it is nan), but if neither operand is inf, when rounding downward it shouldn't be +inf but max representable (or when rounding upward not -inf but min representable). So I assume we should tweak frange_arithmetics for this behavior when flag_rounding_math.
next prev parent reply other threads:[~2022-12-06 15:59 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-12-05 2:51 [Bug c/107967] New: The gcc commit 2f7f9edd28d " caiyinyu at loongson dot cn 2022-12-05 8:24 ` [Bug tree-optimization/107967] " rguenth at gcc dot gnu.org 2022-12-05 9:08 ` caiyinyu at loongson dot cn 2022-12-05 9:56 ` [Bug tree-optimization/107967] [13 regression] " pinskia at gcc dot gnu.org 2022-12-05 10:35 ` [Bug tree-optimization/107967] [13 regression] The gcc commit r13-3923 " jakub at gcc dot gnu.org 2022-12-05 10:55 ` aldyh at gcc dot gnu.org 2022-12-05 14:29 ` marxin at gcc dot gnu.org 2022-12-05 16:40 ` jakub at gcc dot gnu.org 2022-12-06 1:32 ` caiyinyu at loongson dot cn 2022-12-06 15:59 ` jakub at gcc dot gnu.org [this message] 2022-12-06 17:16 ` jakub at gcc dot gnu.org 2022-12-06 20:06 ` jakub at gcc dot gnu.org 2022-12-07 1:34 ` caiyinyu at loongson dot cn 2022-12-07 16:59 ` amacleod at redhat dot com 2022-12-08 9:36 ` cvs-commit at gcc dot gnu.org 2022-12-08 10:24 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-107967-4-yVEreak9p9@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).