Pointer type problem (plain C on i386)
Richard Henderson
rth@redhat.com
Sun Feb 25 10:40:00 GMT 2001
On Mon, Feb 19, 2001 at 02:46:47PM +0100, Balazs Takacs wrote:
> > #define DIO_HIWORD(x) ((unsigned short *) &(x))[1]
[...]
> > data = *buf++;
> > outw(DIO_LOWORD(data), iobase);
> > outw(DIO_HIWORD(data), iobase);
This code is incorrect. You've violated type aliasing rules.
And in this case, for no apparent reason -- you could just as
well have written
outw(data, iobase);
outw(data >> 16, iobase);
r~
More information about the Gcc-bugs
mailing list