From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7A5423858D39; Wed, 17 Apr 2024 23:18:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A5423858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713395919; bh=RfqILuX8Zt5s6svd2DvbHOrZgf7oy4c8pbsW6BdrX2g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=IwuXBla5dEvDeiCGQQ+g3eCoi4XAMlD7vu0OYEc0dk1lWeCGJxarRBsL7QAXWW9fb vjPDZ4AEmB7iKHA8I2qSB6d+5ekq852I8XSNUiGIhNIYNYxIM6k6JhEcuufAV6L8GQ QCaHFD4CbIAd7BY/XdaZtatOeX21xhLpOLk3GN1g= From: "vincent-gcc at vinc17 dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/114746] With FLT_EVAL_METHOD = 2, -fexcess-precision=fast reduces the precision of floating-point constants Date: Wed, 17 Apr 2024 23:18:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: vincent-gcc at vinc17 dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114746 --- Comment #1 from Vincent Lef=C3=A8vre --- There is the same issue with constant floating-point expressions. Consider the following program given at https://github.com/llvm/llvm-project/issues/89128 #include #include static double const_init =3D 1.0 + (DBL_EPSILON/2) + (DBL_EPSILON/2); int main() { double nonconst_init =3D 1.0; nonconst_init =3D nonconst_init + (DBL_EPSILON/2) + (DBL_EPSILON/2); printf("FLT_EVAL_METHOD =3D %d\n", FLT_EVAL_METHOD); printf("const: %g\n", const_init - 1.0); printf("nonconst: %g\n", (double)nonconst_init - 1.0); } With -m32 -mno-sse, one gets FLT_EVAL_METHOD =3D 2 const: 0 nonconst: 2.22045e-16 instead of FLT_EVAL_METHOD =3D 2 const: 2.22045e-16 nonconst: 2.22045e-16=