This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[OB PATCH] Fix uninitialized type_flags variable


If uninitialized, type_flags can contain a random value. If the
arch-specific code doesn't set a value, this give unexpected results.

I believe this is an obvious change. Since I don't have commit access yet,
could anybody push this?

gdb/ChangeLog
2014-01-16  Simon Marchi  <simon.marchi@ericsson.com>

	* gdbtypes.c (address_space_name_to_int): Initialize type_flags to 0.

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 042c17d..7d9485a 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -531,7 +531,7 @@ lookup_function_type_with_arguments (struct type *type,
 int
 address_space_name_to_int (struct gdbarch *gdbarch, char *space_identifier)
 {
-  int type_flags;
+  int type_flags = 0;

   /* Check for known address space delimiters.  */
   if (!strcmp (space_identifier, "code"))


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