linux-mips
[Top] [All Lists]

Re: [PATCH] casts in TLB macros

To: "Ralf Baechle" <ralf@linux-mips.org>
Subject: Re: [PATCH] casts in TLB macros
From: "Andrew Isaacson" <adi@broadcom.com>
Date: Wed, 17 Aug 2005 09:30:02 -0700
Cc: linux-mips@linux-mips.org
In-reply-to: <20050817100830.GA2667@linux-mips.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20050817030608.GM24444@broadcom.com> <20050817100830.GA2667@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.4.2.1i
On Wed, Aug 17, 2005 at 11:08:30AM +0100, Ralf Baechle wrote:
> On Tue, Aug 16, 2005 at 08:06:08PM -0700, Andrew Isaacson wrote:
> 
> > Fix three cases where macro arguments are not parenthesized, leading to
> > incorrect operator precedence when called with an expression as the
> > argument.  This causes incorrect evaluation of
> >     write_c0_entrylo0(pte_val(*ptep++) >> 6)
> > when pte_t is 64 bits - the pte value is cast to (unsigned int) first,
> > then the shift is done, losing the top 32 bits.
> > 
> > Also, this does not add an extra set of parentheses surrounding the
> > (cast)(value) pair, as there's no danger of precedence problems to avoid
> > given the high precedence of the cast operator and that this is the
> > terminal macro in this macro trail.
> 
> Thanks, applied,

Thank *you* for being smarter than me about the parenthesis...

(The patch I sent out was lacking the outer parens, and I used the
following plan for world domination:
1. notice problem, cut patch
2. go to dinner
3. test compile something unrelated by accident
4. send patch to mailing list
5. profit!)

-andy


<Prev in Thread] Current Thread [Next in Thread>