From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D66AF3858D3C; Sat, 15 Jul 2023 18:32:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D66AF3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689445959; bh=fPuvD5IUsWdw70rDZclUEC8cb0GT9RMW77BW8bP/K0s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eAwUra1LwiaQPJOqHICNMI54ojwRlVeSsM8p7fcEmVau4/W28FN1i88gRvE2W0wtr UxygaxnJ9hMWovVHSE5y/Wk0WUWoFoGaFZbW7I2jQNz6x8cyN2qKTJHot69wwTuu+o XzbWQy1OxhayCqlTvy7AkQrbbnmy1q+y47C3xS2Y= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/110676] strlen of array[1] should not be optimized to 1 if using ASAN Date: Sat, 15 Jul 2023 18:32:39 +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: normal X-Bugzilla-Who: pinskia 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: short_desc everconfirmed bug_status cf_reconfirmed_on 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=3D110676 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|builtin optimization |strlen of array[1] should |prevents ASan from |not be optimized to 1 if |detecting OOB reads |using ASAN Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2023-07-15 --- Comment #1 from Andrew Pinski --- Confirmed. It is only an array of size 1 which is going to cause this issu= e. array of size 2 is always fine, e.g.: ``` #include int main(void) { char s[2] =3D "AA"; return strlen(s); } ``` gives the expected error message.=