From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 31AEF3858439; Wed, 24 Nov 2021 22:22:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31AEF3858439 From: "joseph at codesourcery dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/103406] [12 Regression] gcc -O0 behaves differently on "DBL_MAX related operations" than gcc -O1 and above Date: Wed, 24 Nov 2021 22:22:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: joseph at codesourcery dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: roger at nextmovesoftware dot com X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2021 22:22:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103406 --- Comment #11 from joseph at codesourcery dot com --- The sign of a NaN result is never specified in C except for fabs,=20 copysign, negation, unary + (and assignment to the same format in the case= =20 where that's copy rather than convertFormat). The result should of course be NaN (of any sign), not 0. The reason soft-fp (and thus sfp-machine.h) has special support for=20 choosing a NaN result based on NaN operands is because soft-fp is also=20 used in the Linux kernel for emulating floating-point instructions, and in= =20 that context the aim is to follow the semantics of those instructions,=20 which specifies things left unspecified in IEEE 754 and its C bindings.=20= =20 That isn't relevant at the level of C code or libgcc functions.=