[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: stupid pointer alignment question (re: cernlib on m68k)

> I am wondering: will g77 et al. cause programs to automatically align all
> 32-bit integers in memory with pointers that are multiples of 4 bytes?
> (Given that the integers are array elements that aren't members of any
> other structure, and exist at compile time.)  Because I'm seeing a bug in
> pawX11.static (in cernlib's paw-static package) on m68k that appears to
> result from a violation of that assumption.

I don't think there's such a thing as automatic alignment to 4 byte
boundaries on m68k, so the assumption would be unjustified:

           Control whether GCC aligns "int", "long", "long long", "float",
           "double", and "long double" variables on a 32-bit boundary
           (-malign-int) or a 16-bit boundary (-mno-align-int).  Aligning
           variables on 32-bit boundaries produces code that runs somewhat
           faster on processors with 32-bit busses at the expense of more mem-

           Warning: if you use the -malign-int switch, GCC will align struc-
           tures containing the above types  differently than most published
           application binary interface specifications for the m68k.

(taken from gcc 3.3 info)

Note that this option is new in gcc 3 - gcc 2.95 didn't have it. And (in
accordance with above warning) it doesn't seem to be active by default.


Reply to: