Subject: Re: kern/34751: regular panics in tcp_sack_option on NetBSD/alpha 3.0_STABLE
To: None <netbsd-bugs@NetBSD.org>
From: Christian Biere <christianbiere@gmx.de>
List: netbsd-bugs
Date: 10/09/2006 05:07:13
Christian Biere wrote:
> Izumi Tsutsui wrote:
> > > Would you mind showing me the generated assembler code on Alpha anyway?
> >
> > der Mouse already provides right fix, I think.
> > http://mail-index.netbsd.org/port-alpha/2006/10/08/0001.html
> > (i.e. gcc assumes (uint32_t *) pointers are 4-byte aligned)
>
> Not just GCC. That's basic C. I didn't look at that line but
> (some_integer_type *) are almost always wrong. Obviously,
> GCC warns about this by default and the author added the bogus
> cast to suppress the valid warning.
IOW, that's exactly the reason why memcpy() is used there in
first place. If it was as simple as using a cast you could
just write
left = ntohl(*lp);
right = ntohl(*(lp + 1));
--
Christian