* [Bug lto/98912] valgrind error in default_elf_asm_output_ascii
2021-02-01 10:44 [Bug lto/98912] New: valgrind error in default_elf_asm_output_ascii dcb314 at hotmail dot com
@ 2021-02-01 14:47 ` marxin at gcc dot gnu.org
2021-02-01 14:52 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-01 14:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98912
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2021-02-01
Status|UNCONFIRMED |WAITING
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Hm, this one is about streaming of
lto_section s
= { LTO_major_version, LTO_minor_version, slim_object, 0 };
s.set_compression (compression);
lto_write_data (&s, sizeof s);
where sizeof s == 8.
I cannot reproduce it..
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/98912] valgrind error in default_elf_asm_output_ascii
2021-02-01 10:44 [Bug lto/98912] New: valgrind error in default_elf_asm_output_ascii dcb314 at hotmail dot com
2021-02-01 14:47 ` [Bug lto/98912] " marxin at gcc dot gnu.org
@ 2021-02-01 14:52 ` jakub at gcc dot gnu.org
2021-02-01 14:58 ` dcb314 at hotmail dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-01 14:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98912
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Well, lto_section is 8 byte long struct containing 2 ushort fields, 1 uchar,
one byte padding (on most hosts) and one ushort field.
So bet valgrind is complaining about streaming the padding...
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/98912] valgrind error in default_elf_asm_output_ascii
2021-02-01 10:44 [Bug lto/98912] New: valgrind error in default_elf_asm_output_ascii dcb314 at hotmail dot com
2021-02-01 14:47 ` [Bug lto/98912] " marxin at gcc dot gnu.org
2021-02-01 14:52 ` jakub at gcc dot gnu.org
@ 2021-02-01 14:58 ` dcb314 at hotmail dot com
2021-02-02 9:25 ` marxin at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dcb314 at hotmail dot com @ 2021-02-01 14:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98912
--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---
For varasm.c line 8285 is
for (p = s; p < limit && *p != '\0'; p++)
So either the limit is wrong or there are some un-init bytes in
the string. My money is on option 2 ;->
Maybe a suitable first step would be to produce some debug output,
(maybe fprintf on stderr ?) of the parameters to default_elf_asm_output_ascii,
i.e s and len.
Whichever of s or len that valgrind detects would be the culprit.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/98912] valgrind error in default_elf_asm_output_ascii
2021-02-01 10:44 [Bug lto/98912] New: valgrind error in default_elf_asm_output_ascii dcb314 at hotmail dot com
` (2 preceding siblings ...)
2021-02-01 14:58 ` dcb314 at hotmail dot com
@ 2021-02-02 9:25 ` marxin at gcc dot gnu.org
2021-02-02 9:31 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-02 9:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98912
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> Well, lto_section is 8 byte long struct containing 2 ushort fields, 1 uchar,
> 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
= { LTO_major_version, LTO_minor_version, slim_object, 0 };
s.set_compression (compression);
+ char *ptr = (char *)&s;
+ for (unsigned i = 0; i < sizeof s; i++)
+ fprintf (stderr, "v[%d]=%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 <char[4]> [(struct lto_section *)&s + 2B] = {};
s.major_version = 9;
s.slim_object = prephitmp_911;
s.flags = 1;
and that covers all bytes in the struct.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/98912] valgrind error in default_elf_asm_output_ascii
2021-02-01 10:44 [Bug lto/98912] New: valgrind error in default_elf_asm_output_ascii dcb314 at hotmail dot com
` (3 preceding siblings ...)
2021-02-02 9:25 ` marxin at gcc dot gnu.org
@ 2021-02-02 9:31 ` jakub at gcc dot gnu.org
2021-02-03 9:54 ` marxin at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-02 9:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98912
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
How exactly it is gimplified depends on the target, optimization level etc.
Anyway, I'd suggest just to add a unsigned char padding; to the structure, that
seems easiest.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/98912] valgrind error in default_elf_asm_output_ascii
2021-02-01 10:44 [Bug lto/98912] New: valgrind error in default_elf_asm_output_ascii dcb314 at hotmail dot com
` (4 preceding siblings ...)
2021-02-02 9:31 ` jakub at gcc dot gnu.org
@ 2021-02-03 9:54 ` marxin at gcc dot gnu.org
2021-02-03 12:19 ` cvs-commit at gcc dot gnu.org
2021-02-03 12:19 ` marxin at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-03 9:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98912
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |marxin at gcc dot gnu.org
Status|WAITING |ASSIGNED
--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
All right, I'll send patch for it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/98912] valgrind error in default_elf_asm_output_ascii
2021-02-01 10:44 [Bug lto/98912] New: valgrind error in default_elf_asm_output_ascii dcb314 at hotmail dot com
` (5 preceding siblings ...)
2021-02-03 9:54 ` marxin at gcc dot gnu.org
@ 2021-02-03 12:19 ` cvs-commit at gcc dot gnu.org
2021-02-03 12:19 ` marxin at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-03 12:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98912
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:
https://gcc.gnu.org/g:84110515b93a6709de24240d6658ac207db5129f
commit r11-7057-g84110515b93a6709de24240d6658ac207db5129f
Author: Martin Liska <mliska@suse.cz>
Date: Wed Feb 3 10:53:32 2021 +0100
Fill up padding in lto_section struct.
gcc/ChangeLog:
PR lto/98912
* lto-streamer-out.c (produce_lto_section): Fill up missing
padding.
* lto-streamer.h (struct lto_section): Add _padding field.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/98912] valgrind error in default_elf_asm_output_ascii
2021-02-01 10:44 [Bug lto/98912] New: valgrind error in default_elf_asm_output_ascii dcb314 at hotmail dot com
` (6 preceding siblings ...)
2021-02-03 12:19 ` cvs-commit at gcc dot gnu.org
@ 2021-02-03 12:19 ` marxin at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-03 12:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98912
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
Should be fixed now.
^ permalink raw reply [flat|nested] 9+ messages in thread