From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7FFDF3858D38; Fri, 12 Apr 2024 02:48:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FFDF3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712890080; bh=N39yQSeobRXAA5e3DmTultdmalG4mO6s5EXgRqv3/Ac=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GeyxObc2sYmpFtmQOkEiEBxuXvAam1WqhGHHye1ZJHOeU2ds19n2RBryz6h91Od+M xkHbpBPpL6xu3hHXJcV06qN9Lq88sj56vrENzwynuPwVn4GE8V5HdZOQQMfBdCJzk/ 19NurRoz5MndkOSg8f2EUuivghDy6GUPyFRJvpEc= 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:59 +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 #3 from lin1.hu at intel dot com --- (In reply to lin1.hu from comment #2) > (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. https://godbolt.org/z/Wbzx5Edsj=