This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: trivial fix for valgrind-reported error
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 15 Feb 2010 13:42:10 -0700
- Subject: FYI: trivial fix for valgrind-reported error
- Reply-to: Tom Tromey <tromey at redhat dot com>
I'm checking this in.
valgrind reports a use of an uninitialized value in c-typeprint.c when I
run it on gdb using a slightly modified classes.exp test case.
The bug is that 'basetype' is uninitialized when get_vptr_fieldno
returns -1. The fix is to reverse the order of a test to avoid testing
'basetype' in this case.
There is no real bug here, in that gdb cannot get the wrong answer, even
with the old code. This change just silences the valgrind error.
Tom
2010-02-15 Tom Tromey <tromey@redhat.com>
* c-typeprint.c (c_type_print_base): Reverse order of test.
Index: c-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-typeprint.c,v
retrieving revision 1.51
diff -u -r1.51 c-typeprint.c
--- c-typeprint.c 2 Feb 2010 16:47:13 -0000 1.51
+++ c-typeprint.c 15 Feb 2010 20:40:48 -0000
@@ -832,7 +832,7 @@
/* If we have a virtual table pointer, omit it. Even if
virtual table pointers are not specifically marked in
the debug info, they should be artificial. */
- if ((type == basetype && i == vptr_fieldno)
+ if ((i == vptr_fieldno && type == basetype)
|| TYPE_FIELD_ARTIFICIAL (type, i))
continue;