Re: gcc 4.5.1 / as 2.20.51.0.11 miscompiling drivers/char/i8k.c ?

From: Dave Korn
Date: Mon Nov 08 2010 - 13:15:58 EST


On 08/11/2010 11:20, Andi Kleen wrote:

> An asm with live inputs and outputs should never be optimized
> way. If 4.5.1 started doing that it's seriously broken.

I don't see that. Consider:

void foo (void)
{
int x, y, z;
x = 23;
y = x + 1;
z = y + 1;
}

So far, you'd agree the compiler may optimise the entire function away? So
why not this:

void foo (void)
{
int x, y, z;
x = 23;
asm ("do something" : "=r" (y) : "r" (x) );
z = y + 1;
}

?

cheers,
DaveK
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/