From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 507E9385843E; Fri, 26 May 2023 16:48:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 507E9385843E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685119736; bh=ZPoVSps8Mxh6RvLWgZshPdP9i0XIguDu5AuTdpC6rz4=; h=From:To:Subject:Date:From; b=kSJlKU4C7IuDV7oOlMx30fEwIQGOPEBXRQ9RP5zrk/NWIyNDfp2XMcnPYFNFAfJu8 kiOMvqt9+cl1s2qWwBYVzL5rdSyk32UfJQvb9tenQdtznyREkb1HX9RjdlcSwyLlQf IkbvFLZJ++72i7XSEZcb+t8seh9DsiqwQo0Wi8H4= From: "bruno at clisp dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/109995] New: Bogus warning about __builtin_memset, from -Wstringop-overflow Date: Fri, 26 May 2023 16:48:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bruno at clisp dot 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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=3D109995 Bug ID: 109995 Summary: Bogus warning about __builtin_memset, from -Wstringop-overflow Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: bruno at clisp dot org Target Milestone: --- Created attachment 55171 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D55171&action=3Dedit test case bar.c In the attached program, -Wall produces a warning "warning: =E2=80=98__buil= tin_memset=E2=80=99 specified bound 18446744073709551614 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=3D]", in a function that does not = invoke 'memset' nor '__builtin_memset'. With gcc 10.4.0: $ gcc -O2 -Wall -S bar.c In function =E2=80=98memset_small=E2=80=99, inlined from =E2=80=98wrap=E2=80=99 at bar.c:242:1: bar.c:249:17: warning: =E2=80=98__builtin_memset=E2=80=99 specified bound 1= 8446744073709551614 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=3D] 249 | do *++p =3D c; while (--n > 0); | ~~~~~^~~ With gcc 11.3.0, 12.3.0, 13.1.0: $ gcc -O2 -Wall -S bar.c In function =E2=80=98memset_small=E2=80=99, inlined from =E2=80=98memset_small=E2=80=99 at bar.c:242:1, inlined from =E2=80=98wrap=E2=80=99 at bar.c:590:19: bar.c:249:17: warning: =E2=80=98__builtin_memset=E2=80=99 specified bound 1= 8446744073709551614 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=3D] 249 | do *++p =3D c; while (--n > 0); | ~~~~~^~~=