This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix --enable-checking=valgrind PCH failure


Hi!

The padding in v contains uninitialized garbage which we then write into
the PCH file.  This isn't the only issue with --enable-checking=valgrind
and PCH, the other issue is that PCH dumps the full size of allocated
objects, even when they haven't been initialized at all (e.g. because token
size is 0), which triggers errors with the valgrind markups.  Perhaps we'd
need to temporarily make the unaccessible fields defined and reset it back
or something similar.

Anyway, this one is the easy part, bootstrapped/regtested on x86_64-linux
and i686-linux, ok for trunk?

2010-02-11  Jakub Jelinek  <jakub@redhat.com>

	* c-pch.c (pch_init): Clear v.

--- gcc/c-pch.c.jj	2009-06-30 13:10:30.000000000 +0200
+++ gcc/c-pch.c	2010-02-11 16:16:11.000000000 +0100
@@ -134,6 +134,7 @@ pch_init (void)
 
   gcc_assert (memcmp (executable_checksum, no_checksum, 16) != 0);
 
+  memset (&v, '\0', sizeof (v));
   v.debug_info_type = write_symbols;
   {
     size_t i;

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]