From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2CBF13858C78; Wed, 20 Mar 2024 06:19:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2CBF13858C78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710915558; bh=C/uvLul6zt1uWo2XChh91J7dl4l+Ncp3Fm1KBCqTBj0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cRm2GPTkrb5coIpYPRDv1F1NhR4rlxF/WyL4NEWHE3IP887FrW1gDX4KbZeoDzlLQ uXycpjkScaLGi2oeUIetCenwf89op6kS8HaY6OFMVDBCfWIJ3KZmxWWElpTFjO5LL2 RksGx6dz4aNVl3kaG+8lCrNUh80mICPADyIOy+zo= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/114347] wrong constant folding when casting __bf16 to int Date: Wed, 20 Mar 2024 06:19:17 +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: 13.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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=3D114347 --- Comment #11 from Andrew Pinski --- (In reply to Paul Eggert from comment #10) > (In reply to Jakub Jelinek from comment #6) > > You can use -fexcess-precision=3D16 if you don't want treating _Float16= and > > __bf16 as having excess precision. With excess precision, I think the = above > > behavior is correct. >=20 > So the constant 257.0bf16 has a value that the type __bf16 cannot represe= nt? > Although the C standard allows this sort of thing, it doesn't sound wise. This is also true for similar case for 32bit x86 (without using SSE) and constants ending in f or other floating point constants. Just folks hit it there as much as that is not used as much either.=