From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5CF3B3858D33; Fri, 12 Apr 2024 02:47:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5CF3B3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712890022; bh=eXrClVo7EMMM7fzU77S82ECR5O36kCMLwYMGCbQ93BA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=IDSLN9ZBrmTRMN5WRXxqvCJl6gqGuMGrkW12rg8JiSnlMAqKnxEZ31qwUNPAIJuGn DNjMQ+pSpSuDqM/41U2eEwfvFs/uF7Tn2j89ytxYGERmF+YH5dhsuL/kvlHIqvUpHi bHLfW5XYsLfKLMIsygMwHBiDukr18+5ayNXHkGAA= 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 02:47:02 +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 #2 from lin1.hu at intel dot com --- (In reply to Andrew Pinski from comment #1) > Gcc's trapv is known not always to work correctly. >=20 > Try -fsanitize=3Dundefined instead. Thanks, it solves the problem to some extent. But c is eliminated, I think = c - y may cause signed overflow, c https://godbolt.org/z/Wbzx5Edsj=