public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@transmeta.com>
To: Julian Anastasov <ja@ssi.bg>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: cpuid_eax damages registers (2.4.7pre7)
Date: Thu, 19 Jul 2001 16:23:35 -0700	[thread overview]
Message-ID: <3B576BF7.DE801DC2@transmeta.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0107200206460.1820-100000@u.domain.uli>

Julian Anastasov wrote:
> 
>         Hello,
> 
> 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
otherwise couldn't.

However, it's still a bug.

	-hpa

  reply	other threads:[~2001-07-19 23:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-18 10:48 cpuid_eax damages registers (2.4.7pre7) Julian Anastasov
2001-07-18 15:10 ` Linus Torvalds
2001-07-18 17:08   ` Julian Anastasov
2001-07-18 17:21     ` Linus Torvalds
2001-07-18 20:43       ` Kai Germaschewski
2001-07-18 22:04       ` Linus Torvalds
2001-07-18 22:25         ` Kai Germaschewski
2001-07-19  8:23         ` Julian Anastasov
2001-07-19 18:36           ` H. Peter Anvin
2001-07-20  1:42         ` Julian Anastasov
2001-07-19 22:51           ` H. Peter Anvin
2001-07-20  2:01             ` Julian Anastasov
2001-07-19 23:02               ` H. Peter Anvin
2001-07-19 22:55           ` Linus Torvalds
2001-07-20  2:19             ` Julian Anastasov
2001-07-19 23:23               ` H. Peter Anvin [this message]
2001-07-19 23:24               ` Linus Torvalds
2001-07-22  0:00         ` Richard Henderson
2001-07-22  4:27           ` H. Peter Anvin
2001-07-21 23:45   ` Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2001-07-18 20:30 Rick Hohensee
2001-07-19  5:15 ` Keith Owens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B576BF7.DE801DC2@transmeta.com \
    --to=hpa@transmeta.com \
    --cc=hpa@zytor.com \
    --cc=ja@ssi.bg \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox