From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BEC813858C5E; Wed, 15 Mar 2023 08:25:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEC813858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678868705; bh=16kL1PkLB3i3xXYJee9E8012Z1kMm+Kz+gjBIUwRM4Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BcEruvOSrKPT4LrCocJC5DpiYCGy6wJHS56VVTBG3F6DZwkqq8bYX3NqlFM4q+Uf2 GjswW4NMRWEvOG46kKvb6nqOVDSttVl7R+fXW6jzmyHokc0HBNViCfhIRHNwOIrfn/ qmaDD5EhxUaHMY7BcmO1xXcSjHB5o82vtV3SAZFQ= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/109134] UBSan signed integer overflow check missing Date: Wed, 15 Mar 2023 08:24:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org 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=3D109134 --- Comment #1 from Richard Biener --- Having that extra TYPE_OVERFLOW_SANITIZED really isn't sustainable. But the main issue is that the instrumentation happens after (some) folding has tak= en place. We probably also have still code second-guessing TYPE_OVERFLOW_UNDEFINED if !TYPE_OVERFLOW_WRAPS or the other way around - it would be best to transition to TYPE_OVERFLOW_BEHAVIOR () yielding an enum, there can only be one of { wraps, undefined, traps, sanitized } and transforms relying on undefined overflow shall not trigger when it's 'sanitized'. If it were not for the second-guessing code then adjusting TYPE_OVERFLOW_UNDEFINED to false when sanitizing should work (but TYPE_OVERFLOW_WRAPS should still return false as well!). It might also work to magically switch back to undefined after instrumentation.=