From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7E78A3858CDA; Mon, 26 Sep 2022 08:36:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E78A3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664181370; bh=Qk8bkHE44juY7IP7sItZ2MQ8xaokmLMNvGIIwgoXx1Y=; h=From:To:Subject:Date:From; b=NPKWHqDK8YqKc9Gv+RgKGnpZuuIcN+5NEoJwvcDoKOhqNRy+yZ2apgYi95yPjrBI7 k5cds6uSFfEmyzXs488vJaEdnBLPlw/lctGaubMWpMRjf2G2dClEgvF7JsXGNZzDH2 cvBCLmAVbHTwKvWB6ZwSQdTzqGyF5w4GWI1WCKl4= From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107038] New: [13 Regression] Bogus -Wstringop-overflow= since r13-2789-gb40b3035879cf695 Date: Mon, 26 Sep 2022 08:36:09 +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: 13.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 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=3D107038 Bug ID: 107038 Summary: [13 Regression] Bogus -Wstringop-overflow=3D since r13-2789-gb40b3035879cf695 Product: gcc Version: 13.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: amacleod at redhat dot com, msebor at gcc dot gnu.org Target Milestone: --- Created attachment 53627 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53627&action=3Dedit Original unreduced test-case Reduced from elfutils: $ cat core-file.c #include struct ar_hdr { char ar_mode[8]; char ar_size[10]; }; int r; struct Elf { int fildes; } pread_retry(int fd, void *buf, size_t len, off_t offset) { ssize_t recvd; r =3D pread(fd, buf + recvd, len - recvd, offset); } void elf_begin_rand() { struct Elf *parent; struct ar_hdr h; pread_retry(parent->fildes, h.ar_size, sizeof(h.ar_size), 0); } $ gcc core-file.c -c -O2 -Werror=3Dstringop-overflow -D_FORTIFY_SOURCE=3D3 In file included from /usr/include/features.h:490, from /usr/include/unistd.h:25, from core-file.c:1: In function =E2=80=98pread=E2=80=99, inlined from =E2=80=98pread_retry=E2=80=99 at core-file.c:13:7, inlined from =E2=80=98elf_begin_rand=E2=80=99 at core-file.c:19:3: /usr/include/bits/unistd.h:74:10: error: =E2=80=98__pread_alias=E2=80=99 wr= iting 18 or more bytes into a region of size 10 overflows the destination [-Werror=3Dstringop-overflow=3D] 74 | return __glibc_fortify (pread, __nbytes, sizeof (char), | ^~~~~~~~~~~~~~~ core-file.c: In function =E2=80=98elf_begin_rand=E2=80=99: core-file.c:4:8: note: destination object =E2=80=98ar_size=E2=80=99 of size= 10 4 | char ar_size[10]; | ^~~~~~~ /usr/include/bits/unistd.h:50:16: note: in a call to function =E2=80=98__pr= ead_alias=E2=80=99 declared with attribute =E2=80=98access (write_only, 2, 3)=E2=80=99 50 | extern ssize_t __REDIRECT (__pread_alias, | ^~~~~~~~~~ cc1: some warnings being treated as errors I'm attaching also original unreduced test-case.=