Re: [PATCH] x86: remove unneeded endless loop in BUG()
From: Jeremy Fitzhardinge
Date: Thu Feb 19 2009 - 15:47:18 EST
H. Peter Anvin wrote:
For that to happen, it would have to move the asm volatile relative to
the __builtin_trap(), which seems slightly unlikely -- are there any
cases at which this has been known to happen, or is that conjecture on
your part?
There's no reason to expect an "asm volatile" to stay put; the
"volatile" has nothing to do with preventing code motion. The only way
to make an asm stick in one place is with data dependencies, and I'm not
sure what the dependency for __builtin_trap might be. I'm guessing its
a "memory" clobber, but that's pure guesswork.
It would be more of a "right thing" to do this with a label on the
__builtin_trap(), but the problem with that labels have function scope
even if they occur inside a block.
No, you can declare them local (__label__ foo). But gcc will happily do
crazy/crappy things with them if you don't actually end up gotoing them
(even indirectly). I've had a couple of go-rounds with the fine helpful
gcc folks on this very issue...
It would be worth checking the archives from about the time I did the
generic BUG stuff; around dec-jan 2006-7, I think.
J
--
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/