From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D29E138582B0; Thu, 23 Feb 2023 19:40:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D29E138582B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677181224; bh=r/mmrijwlGk7/tOOD8vxT7of9/tGO9p93d4QJI3L1Gg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TRxgXqSY75w0hWgQwQ585CPQ6IRAK+NjuQoKm86K4qwGFU/Uqx4c36abqEEghThIV o7OMVFa6NvkdWFLEZPs/BJFbx0Gnha+C/EDQtAwe1inKcvqXQo6KOSeRQwRe+BtukR uqMvMYvF+T4pPob3Ocvcu5KUsr/Q/1XK0IEIlS0k= From: "qinzhao at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/108894] -fsanitize=bounds missing bounds provided by __builtin_dynamic_object_size() Date: Thu, 23 Feb 2023 19:40:23 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: qinzhao at gcc dot gnu.org X-Bugzilla-Status: NEW 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: cc 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=3D108894 qinzhao at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |qinzhao at gcc dot gnu.org --- Comment #7 from qinzhao at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #5) > As for whether -fstrict-flex-arrays=3D should or shouldn't affect > -fsanitize=3Dbounds, making it gradually equivalent to > -fsanitize=3Dbounds-strict, that is a question, perhaps if > -fstrict-flex-arrays=3D is considered as changing the exactly applicable > language standard, with that option it might change what is and is not > undefined behavior. > Siddhesh/Qing, what do you think? from the doc: " -fsanitize=3Dbounds This option enables instrumentation of array bounds. Various out of bounds accesses are detected. Flexible array members, flexible array member-like arrays, and initializers of variables with static storage are not instrumen= ted. -fsanitize=3Dbounds-strict This option enables strict instrumentation of array bounds. Most out of bou= nds accesses are detected, including flexible array members and flexible array member-like arrays. Initializers of variables with static storage are not instrumented. " the situation is very similar to the previous: -Warray-bounds -Warray-bounds=3D2 Per our previous discussion on -Warray-bounds and -Warray-bounds=3D2 and -fstrict-flex-arrays=3DN, I think it's very reasonable to handle the -fsanitize=3Dbounds and -fsanitize=3Dbounds-strict + -fstrict-flex-arrays= =3DN similarly, i.e: 1. let -fstrict-flex-arrays=3DN to control the behavior of -fsanitize=3Dbou= nds; 2. -fsanitize=3Dbounds-strict actually is an alias of -fsanitize=3Dbounds -fstrict-flex-arrays=3D2, i.e, it treats [], [0] as flexible array members= , but treat [1], [4], as regular arrays.=