From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 77D223858C33; Sun, 18 Sep 2022 16:53:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77D223858C33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663520009; bh=+xc0ZfmjJlhMyxN7AmcRtoVDHysYP6IuAMko3zEtxFg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=r9wUbYj6MphaKrqD+OqDtPr/fUGDnqNY4ZDCRWt1RNuAjUf0yMwBNdqerHB9S9esG DnCnDfKTZJGKjUMF5bySbJzGiOAS9hCb8fXyJcQ0yBB0Ndg8aTmJHcHOpsFfeumRA9 BcaKNeTYLweZjO5hz6o95LzgXZzSfDd5CsteemXo= From: "gjl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/99184] [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7 Date: Sun, 18 Sep 2022 16:53:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: gjl at gcc dot gnu.org 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=3D99184 --- Comment #1 from Georg-Johann Lay --- As a work-around, one can cast to an intermediate 64-bit integer: // For [u]int64_t and uint32_t, do #include double x =3D 2.9; int x_int =3D (int) (int64_t) x; uint32_t x_u32 =3D (uint32_t) (uint64_t) x;=