Joerg,

I can't quite see where you are going with all this.

I think we have explained quite clearly the behaviour of the GCC compiler on
the arm platform.

If you don't like any of our proposed solutions, that's fine.
Please fix it *any* way you like, just so long as it works for the arm-gcc
(which we have no control over).

Is that an unreasonable request?

Regards,
Steve


Joerg Schilling wrote:
Steve McIntyre <[EMAIL PROTECTED]> wrote:


I would call this default behavior of GCC a bug.

I'll try to verify this with the C99 standard, but in case GCC is able
to create working code at all (using __attribute__((packed))), it seems like the default behavior does not make sense.

Note that countless C-programs depend on sizeof(struct something) returning
useful values.

In what way are these not useful values? They may not be what you
expect, but It's a long-known feature of C that making assumptions
about structure layout and alignment _will_ bite you.


Well, it returns size numbers of for unused space.


The default behaviour here is (apparently) as specified by the
designers of the hardware in this case. Alignment _really_ matters for
performance on some architectures, and this is one of them.


The usual way to deal with this kind of alignement problems in C is to
add alignement _before_ the next var - not after the last var and counting the numbers to inapropriate places.


The quick-hack fix is to use the __attribute__((packed)) patch; the
real fix is to stop depending on structure setup like this - use a
byte array and work within that as appropriate.


Then must existing software would be void. Do you really intend this?

Jörg


Reply via email to