From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 94961388A824; Mon, 25 May 2020 15:44:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94961388A824 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1590421485; bh=lku1q31DkEzmqtp0NZzhP6KOBYdYKQU72xfiEjGKzDM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=r6hkpdsiw64yZOo66DHUwtQo6UPoD4YbBWGirKn+lBVBKua1LoS5Zspv9lTo9ymyl 2hLaNOFxDTVNF8/fV75Gah1OOclfobcavDt2SZrA+Ra2xTxfLKagwhjIXN8bP56Xyk KK6t0c5Bq9UgzCUFF/BKL0/EBZEvIs1AOrNC/T+A= From: "asolokha at gmx dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/92815] [8/9/10 Regression] spurious -Wstringop-overflow writing into a flexible array of an extern struct Date: Mon, 25 May 2020 15:44:45 +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: 10.0 X-Bugzilla-Keywords: diagnostic, patch, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: asolokha at gmx dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc attachments.created 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, 25 May 2020 15:44:45 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D92815 Arseny Solokha changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |asolokha at gmx dot com --- Comment #9 from Arseny Solokha --- Created attachment 48593 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D48593&action=3Dedit Diff between assembler output produced by gcc and g++ 11 Though there are no flexible array members in C++, is it expected for g++ to behave differently w/ this testcase? While compiling it w/ gcc yeilds the following, which is expected: % gcc-11.0.0 -c gcc/testsuite/gcc.dg/builtin-object-size-21.c gcc/testsuite/gcc.dg/builtin-object-size-21.c:29:14: error: size of variable 'xm3_4' is too large 29 | struct Ax_m3 xm3_4 =3D { { 0 }, { 1, 2, 3, 3 } }; // { dg-error "= too large" } | ^~~~~ gcc/testsuite/gcc.dg/builtin-object-size-21.c:43:14: error: size of variable 'xmx_1' is too large 43 | struct Ax_mx xmx_1 =3D { { 0 }, { 1 } }; // { dg-error "= too large" } | W/ g++ I have % g++-11.0.0 -c gcc/testsuite/gcc.dg/builtin-object-size-21.c /tmp/ccPBumhF.s: Assembler messages: /tmp/ccPBumhF.s: Fatal error: can't write 14 bytes to section .text of /tmp/ccj6lymE.o: 'file truncated' /usr/lib/gcc/x86_64-unknown-linux-gnu/11.0.0/../../../../x86_64-unknown-lin= ux-gnu/bin/as: BFD (Gentoo 2.34 p4) 2.34.0 assertion fail /var/tmp/portage/sys-devel/binutils-2.34-r1/work/binutils-2.34/bfd/elf.c:31= 69 /tmp/ccPBumhF.s: Fatal error: can't close /tmp/ccj6lymE.o: file truncated because of [pid 1165642] openat(AT_FDCWD, "builtin-object-size-21.o", O_RDWR|O_CREAT|O_TRUNC, 0666) =3D 3 <=E2=80=A6> [pid 1165642] fstat(3, {st_mode=3DS_IFREG|0644, st_size=3D0, ...}) =3D 0 [pid 1165642] lseek(3, -9223372036854775808, SEEK_SET) =3D -1 EINVAL (Inval= id argument) Or, when writing to an "endless" file w/ -o /dev/null: [pid 1164514] lseek(3, -9223372036854775808, SEEK_SET) =3D 0 [pid 1164514] read(3, "", 640) =3D 0 [pid 1164514] lseek(3, 640, SEEK_CUR) =3D 0 [pid 1164514] write(3, "\0builtin-object-size-21.c\0xm3_0\0"..., 96) =3D 96 [pid 1164514] lseek(3, 0, SEEK_SET) =3D 0 [pid 1164514] read(3, "", 4096) =3D 0 [pid 1164514] lseek(3, 64, SEEK_CUR) =3D 0 [pid 1164514] write(3, "UH\211\345\220]\303UH\211\345\220]\303", 14) =3D 14 [pid 1164514] lseek(3, 0, SEEK_SET) =3D 0 [pid 1164514] read(3, "", 4096) =3D 0 [pid 1164514] lseek(3, 96, SEEK_CUR) =3D 0 [pid 1164514] write(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096= ) =3D 4096 [pid 1164514] write(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096= ) =3D 4096 [pid 1164514] write(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096= ) =3D 4096=