This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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]

Re: structure size and structure element offset calculation issue


On Mon, May 26, 2014 at 10:31 PM, Sivaprasad
<sivaprasad.pv@redpinesignals.com> wrote:
>
> By packing the structure, issue got solved but generating more code.
> How can I make our cross compiler to generate size of struct { short s;} as
> 2 instead of 4 ?

This is not quite the question you asked last time.  I would expect
that sizeof(struct{short s;}) would return 2.  It does on x86.

> Is it required to change any macro's in port.h?

If for your private port sizeof(struct{short s;}) does not return 2
(and assuming that sizeof(short) does return 2), then, yes, you can
change something in your private port to fix that.  It's not the
default case, so it would be something unusual that your port is
doing.  For example, perhaps you have defined ADJUST_FIELD_ALIGN.

Ian


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