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]

append_composite_type_field: correct the location of appended struct fields


I noticed while rebasing a patch from our internal tree to mainline, that
I was working on top of this two year old fix of Daniel's.  All current callers
of append_composite_type_field care about enums only, so this code path isn't
being exercised currently.

Nonetheless, tested on x86_64-linux and checked in.

-- 
Pedro Alves
2009-01-09  Daniel Jacobowitz  <dan@codesourcery.com>

	* gdbtypes.c (append_composite_type_field): Correct the location of
	appended fields.

---
 gdb/gdbtypes.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Index: gdb/gdbtypes.c
===================================================================
--- gdb/gdbtypes.c.orig	2009-01-09 00:56:32.000000000 +0000
+++ gdb/gdbtypes.c	2009-01-09 17:36:43.000000000 +0000
@@ -1856,10 +1856,9 @@ append_composite_type_field (struct type
     {
       TYPE_LENGTH (t) = TYPE_LENGTH (t) + TYPE_LENGTH (field);
       if (TYPE_NFIELDS (t) > 1)
-	{
-	  FIELD_BITPOS (f[0]) = (FIELD_BITPOS (f[-1])
-				 + TYPE_LENGTH (field) * TARGET_CHAR_BIT);
-	}
+	FIELD_BITPOS (f[0]) = (FIELD_BITPOS (f[-1])
+			       + (TYPE_LENGTH (FIELD_TYPE (f[-1]))
+				  * TARGET_CHAR_BIT));
     }
 }
 

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