Subject: Re: Exactly what is wrong with our compiler?
To: None <eeh@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: port-sparc64
Date: 01/03/2002 10:07:49
On Thu, Jan 03, 2002 at 05:00:51PM -0000, eeh@netbsd.org wrote:

 > As far as I know the NTP problem is not a sparc64 specific problem but
 > a general gcc foulup that happens to hit sparc64 because it's a 64-bit
 > platform and doesn't to alignment fixups.

It is not a "foulup".  This issue has been gone over many times on
both NetBSD and GCC mailing lists.

Basically, "do not tell the compiler that an object is aligned if its
not aligned".  That is, if an ifr structure is not aligned, don't access
it using a "struct ifr *", because a pointer to an object is (correctly)
assumed to be aligned to the alignment necessary to access that object.

GCC is *not* in the wrong here, the code is.

Now, IMO, GCC should pay attention to a cast of such a pointer to a
lesser-aligned pointer (e.g. (char *) &ifr); the Tru64 compiler does
this.  However, the GCC maintainers disagreee on this point, and honestly,
I'm not worried about it enough to lose any sleep over it :-)

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>