public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* exp/2266: append_composite_type_field() is wrong for structs as opposed to unions
@ 2007-05-29 21:08 dporges
  0 siblings, 0 replies; only message in thread
From: dporges @ 2007-05-29 21:08 UTC (permalink / raw)
  To: gdb-gnats


>Number:         2266
>Category:       exp
>Synopsis:       append_composite_type_field() is wrong for structs as opposed to unions
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 29 21:08:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     dporges@chipwrights.com
>Release:        6.6
>Organization:
>Environment:
Linux, cygwin
>Description:
The code in append_composite_type_field(), which builds up internal structure and union types, is wrong for structure fields beyond the first field.  The computation of the bit position of a field is:

FIELD_BITPOS (f[0]) = (FIELD_BITPOS (f[-1])
	+ TYPE_LENGTH (field) * TARGET_CHAR_BIT);

-- "field" is the _current_ field, but you want to add the size of the _previous_ field to the previous bitpos to get the bitpos of the current field.


>How-To-Repeat:
Not repeatable in any existing build, because it looks like no existing target uses internal register types that are structs with more than one field in them.
>Fix:
How about

FIELD_BITPOS (f[0]) = (FIELD_BITPOS (f[-1])
     + TYPE_LENGTH (FIELD_TYPE(f[-1])) * TARGET_CHAR_BIT);
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-29 21:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-29 21:08 exp/2266: append_composite_type_field() is wrong for structs as opposed to unions dporges

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).