Messages in this thread | | | Date | Sun, 2 Jan 2005 11:55:20 +0000 | From | Russell King <> | Subject | Re: [PATCH] Fix MMC warnings |
| |
On Sun, Jan 02, 2005 at 08:44:09AM +0000, Russell King wrote: > On Sun, Jan 02, 2005 at 01:07:31AM +0100, Pierre Ossman wrote: > > Here's a patch that fixes the compiler warnings in mmc.c. > > I'd rather the compiler was fixed so that it does proper analysis of > the code, rather than blatently issuing warnings for code which is > unreachable.
Actually, you're quite correct about the first instance - 'mask' may be generated from 1 << 32 - 1, which is definitely reachable, and gcc will warn about. There's also another bug - an out by one on whether to use the second word to construct the value.
However, the other 5 warnings are due to (corrected version):
if (16 + 0 > 32) __res |= resp[__off-1] << (32 - 0);
Obviously, this code is not reachable since the if condition is false. Therefore, gcc's whinging about the shift being >= 32 is wrong.
That said, the fix doesn't change gcc's code generation, so I think I'll apply the changes. Thanks.
-- Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/ 2.6 Serial core - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |