From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7BC60385DC0B; Mon, 13 Apr 2020 21:38:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BC60385DC0B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586813892; bh=90MUgSWHVIotZ0dcxwd8cf6W4ylS1mRZD61uO+3PrYs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OFLtrUAHCbJ8iooc4Gf7wogJ9Xk++zHjoNg2YNyFZ9WbeMCB4T5J+EVjt1aILcwKH +zpHkiJTvulpxWF9iAs/X9J4K7aFusBp4r6t9A1FR7yvpfpd+YX+/p5HQZU1sz0YDO UWr4fG4EIAkTW1GGJDtELRRO0uRIQfuIuqpKpeEc= From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/92307] missing -Wstringop-overflow on a memcpy into an array with out-of-bounds variable offset Date: Mon, 13 Apr 2020 21:38:12 +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: 9.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: msebor at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status target_milestone cf_known_to_fail cf_known_to_work resolution 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 21:38:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D92307 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Target Milestone|--- |10.0 Known to fail| |8.3.0, 9.2.0 Known to work| |10.0 Resolution|--- |FIXED --- Comment #2 from Martin Sebor --- Fixed in GCC 10 via r279248 which now prints: pr92307.c: In function =E2=80=98f=E2=80=99: pr92307.c:2:3: warning: writing 2 bytes into a region of size 1 [-Wstringop-overflow=3D] 2 | __builtin_memcpy (d, s, n) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ pr92307.c:10:3: note: in expansion of macro =E2=80=98memcpy=E2=80=99 10 | memcpy (p, s, 2); // writing before the beginning of a | ^~~~~~ pr92307.c:4:6: note: at offset 0 to object =E2=80=98a=E2=80=99 with size 2 = declared here 4 | char a[2]; | ^ pr92307.c: In function =E2=80=98g=E2=80=99: pr92307.c:2:3: warning: writing 2 bytes into a region of size 0 [-Wstringop-overflow=3D] 2 | __builtin_memcpy (d, s, n) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ pr92307.c:17:3: note: in expansion of macro =E2=80=98memcpy=E2=80=99 17 | memcpy (p, s, 2); // writing past the end of a | ^~~~~~ pr92307.c:4:6: note: at offset 0 to object =E2=80=98a=E2=80=99 with size 2 = declared here 4 | char a[2]; | ^=