Re: Ext2 patches

Michal Jaegermann (michal@ellpspace.math.ualberta.ca)
Sat, 4 Apr 1998 23:27:53 -0700 (MST)


Linus writes about shifts on the full register width:
> because it is undefined behaviour the compiler is free to do whatever
> it wants to (gcc _happens_ to return 0).

Right! On Intel processor. But gcc happens _not_ to return 0
is a similar situation on Alpha (i.e. a shift right by 64 bits)
which was already a source of nasty bugs. Better watch for it.

On Alpha '(~0UL) >> 64' is actually ignored; you will get ~0UL
back. The same with hiding a constant in an argument to a function.
Shifting by 63 bits will get you 1, as expected.

--mj

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu