Re: cpuid_eax damages registers (2.4.7pre7)
H. Peter Anvin (email@example.com)
Thu, 19 Jul 2001 16:23:35 -0700
Julian Anastasov wrote:
> On Thu, 19 Jul 2001, Linus Torvalds wrote:
> > No. It's correct, because cpuid doesn't have any side effects (*), so we
> > don't need to mark it volatile. gcc is free to remove it if nothing uses
> > the outputs, for example. But gcc cannot (and generally does not) ignore
> > outputs that _are_ specified.
> My understanding was that eax, ... edx are declared as
> local vars and so their values can't be used out of the current
> function scope, even when they are defined in inline func. So, I
> assume they can be optimized (the fact is that they are not used)
> and may be gcc forgets them. True, may be the docs do not cover
> such situations but my first thought was not to explain everything
> with bugs.
Well, your first thought was wrong. It is a bug. Sorry.
However, your argument basically explains why adding "volatile" does work
-- it keeps gcc from thinking that it can optimize away something that it
However, it's still a bug.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to firstname.lastname@example.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/