Subject: re: alignment crash in v6 ipfilter when receiving on gif
To: Martin Husemann <martin@duskware.de>
From: matthew green <mrg@eterna.com.au>
List: port-sparc64
Date: 07/12/2007 08:29:45
   On Wed, Jul 11, 2007 at 07:38:26PM +0100, David Laight wrote:
   > > +			memcpy(&ip6_src, &ip6->ip6_src,
   > > +			       sizeof(struct in6_addr));
   > 
   > Unless we force a function call for memcpy, the compiler can still
   > assume that the source is 64bit aligned and ensure that the target
   > is 64bit aligned and to 64bit operations for the copy!
   
   No, it can't - there is no magic cast involved and it knows the
   alignment guarantees of ip6->ip6_src.

my reading of the above patch is that gcc could use 64 bit
alignment requiring load/stores because all the pointer types
used are to 64 bit types.  pass a (real, not cast) "char *"
or "void *" as the source, and GCC won't think it's always
going to be aligned.


.mrg.