public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Pierre Ossman <drzeus-list@drzeus.cx>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Fix MMC warnings
Date: Sun, 2 Jan 2005 11:55:20 +0000	[thread overview]
Message-ID: <20050102115520.A4166@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20050102084409.A1925@flint.arm.linux.org.uk>; from rmk+lkml@arm.linux.org.uk on Sun, Jan 02, 2005 at 08:44:09AM +0000

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

      reply	other threads:[~2005-01-02 11:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-02  0:07 [PATCH] Fix MMC warnings Pierre Ossman
2005-01-02  8:44 ` Russell King
2005-01-02 11:55   ` Russell King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050102115520.A4166@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=drzeus-list@drzeus.cx \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox