From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5CC55385840C; Mon, 24 Oct 2022 18:40:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5CC55385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666636813; bh=tWc8bsAyXgNInd0Nj4FLc6vDs5mVu+PQnRCbLrjcOHc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=g6c9sWnDO5Zd0l07Lol52eiUT/1YDJsKsQqSx+WPAuiCpJXvectpzF46+kjs4K5UP /tHn9y+sY2HfOsHzHsSVSmhPZoIc6o1Pxlrk/f+XewAul3t4MQC8Ozyl2F3qonCmyF 8aFvlCJSRFS8AuQ16JMD318eA/1Q0My/dH3qmcQs= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107370] long double sqrtl constant folding is wrong Date: Mon, 24 Oct 2022 18:40:13 +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: 10.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW 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: bug_status keywords everconfirmed component short_desc cf_reconfirmed_on 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=3D107370 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Keywords| |wrong-code Ever confirmed|0 |1 Component|target |middle-end Summary|long double precision is |long double sqrtl constant |wrong in ARM 64 |folding is wrong Last reconfirmed| |2022-10-24 --- Comment #4 from Andrew Pinski --- Hmm, this might be a bug in mpfr though. GCC uses MPFR to do constant fold= ing. Without constant folding libm produces: 1.4142135623730950488 That is: ``` #include #include int main(void) { volatile long double a =3D 2.0L; printf("%.20Lg \n",sqrtl(= a)); } ```=