This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFA: fix PR 9164
> Date: Mon, 5 Jan 2009 08:23:36 +0400
> From: Joel Brobecker <brobecker@adacore.com>
>
> > Tom> This fix defers the choice of type to the language, using the existing
> > Tom> language-arch machinery. I fixed the C language family, including
> > Tom> ObjC, but I left the other languages unchanged. I think the language
> > Tom> maintainers will have to make a change here, if one is needed or
> > Tom> desired. (FWIW I don't think Java needs a change, since I don't think
> > Tom> it is possible to invoke sizeof when Java is the selected language.)
> >
> > Daniel> Before adding all this, do you know of any language where the signed
> > Daniel> behavior is correct?
> >
> > Nope. I don't know that a signed type is incorrect, either. I really
> > know nothing about the other languages here, so I chose to preserve
> > the current behavior.
>
> In Ada, the equivalent of the sizeof operator is the 'Size attribute.
> This attribute is a function that returns the size in bits and its
> type is a ``universal_integer''. universal_integer is not a type
> you can use in declarations, but it allows any integer values, so
> I think that it would be reasonable to make the 'size attribute
> return a value of Integer type (thus signed). I checked the code,
> and we actually use builtin_type_int32 (we used to use builtin_type_int
> but this type is hard to get to, now, as you need access to the gdbarch).
Well, using built_type_int32 defenitely feels wrong for a type
representing sizes on a 64-bit system.