From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CEE0E3858D35; Thu, 7 Sep 2023 20:53:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CEE0E3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694119984; bh=hovkwdzl+C86s7+pn49oazqadks7IfS6SpAqEj1UzLg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DjWzbCJK8GHGaTys9b4o/nRal7/qNyr2zzVahy1Y2Ic38xmJ0funeA7ONbHpPrakQ qqaQilO0kFhc3QVmKRobDTCE0s97RVhSv9Au2+m+xPyEe36WPSi1KA5NtYTtFcZ788 cSsePdB/+aBVidurpAfWRYOjniI2Ns9pDiU2MNUw= From: "qinzhao at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/102317] signed integer overflow sanitizer cannot work well with -fno-strict-overflow Date: Thu, 07 Sep 2023 20:53:04 +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: qinzhao at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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=3D102317 --- Comment #12 from qinzhao at gcc dot gnu.org --- (In reply to Kees Cook from comment #11) > The trouble with "optimize" is that it just doesn't work. The kernel has > banned its use because it results in all other optimization options being > forgotten for the function in question. How about Jacub's another suggestion in comment#10: "If you don't want to use optimize attribute, there is always the option to just do the arithmetics in unsigned types in the few selected functions whe= re you don't want the sanitization"? is it possible to use "unsigned" integer instead of "signed" integer for the cases you want the "wrap around" behavior when overflow?=20 if not, what's the major issue with this workaround?=