From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 717183858401; Wed, 19 Jan 2022 14:54:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 717183858401 From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104119] New: Wrong -Werror=format-overflow= since r12-5014-g6b8b959675a3e14c Date: Wed, 19 Jan 2022 14:54:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.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 cc target_milestone 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 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: Wed, 19 Jan 2022 14:54:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104119 Bug ID: 104119 Summary: Wrong -Werror=3Dformat-overflow=3D since r12-5014-g6b8b959675a3e14c Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: aldyh at gcc dot gnu.org, amacleod at redhat dot com Target Milestone: --- Since the revision I see (reduced from multipath-tools package) $ cat devmapper.i struct { char id[8]; int needs_paths_uevent; } *p; void dm_addmap_create() { char *str =3D __builtin_malloc((sizeof("mpath-") - 1) + __builtin_strlen(= p->id) + 10); __builtin_sprintf(str, "mpath-%s", p->id); } $ gcc devmapper.i -c -m32 -O2 -Werror=3Dformat-overflow devmapper.i: In function =E2=80=98dm_addmap_create=E2=80=99: devmapper.i:9:33: error: =E2=80=98%s=E2=80=99 directive writing up to 21474= 83644 bytes into a region of size 2147483641 [-Werror=3Dformat-overflow=3D] 9 | __builtin_sprintf(str, "mpath-%s", p->id); | ^~ devmapper.i:9:3: note: =E2=80=98__builtin_sprintf=E2=80=99 output between 7= and 2147483651 bytes into a destination of size 2147483647 9 | __builtin_sprintf(str, "mpath-%s", p->id); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors Note one needs -m32!=