From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C7D4B3857738; Mon, 7 Aug 2023 14:34:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C7D4B3857738 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691418853; bh=7dkhrx08c0gF5cUR3sdHjsMRmDfFqInTEhZSt80omrE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uXR5qZv0QO8nJdff7VjJW3+aS0nAdGCzZ84nuDulPvPDTPu/lLhp1aE2MQuTGL3A5 NeSP/5u8hSw/EuVnspEbfakJFSzc3ezuAgGpujWxt43Tif12be7leqCmX69y13s49z hOr2KGiiRfRN0W4PjrG+X1EQyUHQ3eA1wgf5faWo= From: "pinskia 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: Mon, 07 Aug 2023 14:34:13 +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: pinskia 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: 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 --- Comment #16 from Andrew Pinski --- (In reply to Niklas Hamb=C3=BCchen from comment #15) > Another common integer overflow bug type is the "for (u32 i =3D 0; i < u6= 4; > ++i)" pattern, as well as general widening comparisons. >=20 > I filed bug 110933 for those; just linking it here for people interested = in > integer overflows. There is no integer overflow here rather there has been wrapping happening.= Yes there is a huge difference between the two. Wrapping is defined behavior wh= ile overflow is undefined behavior.=