From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BEA8E3858D38; Fri, 12 Apr 2024 03:56:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEA8E3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712894174; bh=ATWWYQ4Xh3KBTcVhVEHOwgcXdvQXyHGz2Q5V4oMMjsQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QkeItSqEQgJhPOy3MO739GUVCucqiB8wcKs68B9U+qzj8J3/PqC2+Yl1Xt9pn3Li1 9/0eluYbfldyoP2PDezow3oPg2RMNQS3g0vfYKeX2RuENEjJbHauDT3LUaL9A9gGLs SZDDTtCfbgKQL6nx1ADP7+tREv06szGcndveQ6EU= From: "lin1.hu at intel dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/114700] Front-end optimization generates wrong code with -ftrapv. Date: Fri, 12 Apr 2024 03:56:14 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lin1.hu at intel dot com 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=3D114700 --- Comment #8 from lin1.hu at intel dot com --- (In reply to Andrew Pinski from comment #6) > Note `c - y - c` to become `-y` reduces the possible of an overflow and= is > well defined for wrapping so this might be still on purpose as there will > never be an overflow that causes difference if assuming wrapping ... Indeed, so for -fsanitize=3Dundefined, `c - y - c` become `-y` is right. = It's just missing the optimization to turn `z =3D c - y - c + a + y - b` into= `z =3D a - b`.=