From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 178C43858C53; Fri, 31 Mar 2023 09:33:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 178C43858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680255215; bh=q+wkR4Tr55ez31bgwZmOyi0YTNO70rIiY3W0xLAo92A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GmiVxRv807Wt8FI+UoOXqKMCZwH6qvm2UAZY1I5l/i5w7f6jggbeRsaK/1bAbGU9Z Y+UT7SBOS/vkRUBW3AAIiFj6MMPccQF+uaAqZ4diB5+ABBEeUdjBtEWRW4UBBfmFq2 79fky9+tpkSZokhGstXdlyr6uU9SzFJ9APUgOL9U= From: "rsandifo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/24542] potential unwanted truncation of operation overflow should be warned on assignment to wider variable Date: Fri, 31 Mar 2023 09:33:34 +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: 4.0.2 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rsandifo at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D24542 rsandifo at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rsandifo at gcc dot gnu.org --- Comment #14 from rsandifo at gcc dot gnu.org --- Heh, was in the process of reopening this too, but Richard beat me too it. FWIW, I agree this is worth providing as an option. Another justification is the different promotion handling between u32 =3D u16 op u16 and u64 =3D u32 op u32. "auto" (which wasn't a thing when the PR was first filed) might also increase the chances of accidentally pushing promotions to the root of a multi-statement calculation. I don't think the false positive/negative ratio matters too much for the option itself. If it works then I think it's worth having. IMO the ratio only becomes important if we're considering enabling this by default (unlikely), -Wall (unsure) or -Wextra (seems feasible).=