From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 51E643857824; Tue, 2 Feb 2021 09:25:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51E643857824 From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/98912] valgrind error in default_elf_asm_output_ascii Date: Tue, 02 Feb 2021 09:25:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: unknown X-Bugzilla-Keywords: lto X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: WAITING 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: 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: Tue, 02 Feb 2021 09:25:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98912 --- Comment #4 from Martin Li=C5=A1ka --- (In reply to Jakub Jelinek from comment #2) > Well, lto_section is 8 byte long struct containing 2 ushort fields, 1 uch= ar, > one byte padding (on most hosts) and one ushort field. > So bet valgrind is complaining about streaming the padding... I bet it's complaining about the padding. Please test the following debugging patch: diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 405f3bfc56c..d96a7ee3ec8 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -2672,6 +2672,10 @@ produce_lto_section () lto_section s =3D { LTO_major_version, LTO_minor_version, slim_object, 0 }; s.set_compression (compression); + char *ptr =3D (char *)&s; + for (unsigned i =3D 0; i < sizeof s; i++) + fprintf (stderr, "v[%d]=3D%d\n", i, ptr[i]); + fprintf (stderr, "\n"); lto_write_data (&s, sizeof s); lto_end_section (); destroy_output_block (ob); with GCC 10 the object is constructed in the following way: MEM [(struct lto_section *)&s + 2B] =3D {}; s.major_version =3D 9; s.slim_object =3D prephitmp_911; s.flags =3D 1; and that covers all bytes in the struct.=