Re: [RFC patch 0/4] TSC calibration improvements

From: Linus Torvalds
Date: Sat Sep 06 2008 - 17:22:34 EST




On Sat, 6 Sep 2008, Thomas Gleixner wrote:
>
> One gcc does:
>
> i++;
> if (i >= QUICK_PIT_ITERATIONS)
> goto out;
> expect--;
>
> The other one does:
>
> i++;
> expect--;
> if (i >= QUICK_PIT_ITERATIONS)
> goto out;
>
> Don't ask me which one is correct. It's just reality :(

Show me. Because I simply don't believe you.

The first code is simply _wrong_ - except if "expect" isn't even _used_
afterwards (in which case gcc can optimize away the last unused write).

And I strongly suspect that that is what you've seen.

Because quite frankly, if what you describe is real, then your gcc is
incredibly buggy. So buggy that it sounds unlikely to be able to compile
the kernel in many other places. This is very simple and very fundamental
C, not something subtle or even half-way undefined.

Linus
--
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/