Mail Archives: djgpp/2001/12/06/12:32:47
X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f
|
From: | Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Is it a gcc bug?
|
Date: | 6 Dec 2001 17:27:16 GMT
|
Organization: | Aachen University of Technology (RWTH)
|
Lines: | 28
|
Message-ID: | <9uo9pk$598$1@nets3.rz.RWTH-Aachen.DE>
|
References: | <9uo3dc$i1i$1 AT nntp9 DOT atl DOT mindspring DOT net>
|
NNTP-Posting-Host: | acp3bf.physik.rwth-aachen.de
|
X-Trace: | nets3.rz.RWTH-Aachen.DE 1007659636 5416 137.226.32.75 (6 Dec 2001 17:27:16 GMT)
|
X-Complaints-To: | abuse AT rwth-aachen DOT de
|
NNTP-Posting-Date: | 6 Dec 2001 17:27:16 GMT
|
Originator: | broeker@
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Marp <marp AT 0 DOT 0 DOT 0 DOT 0> wrote:
> I think I might have run into an optimizer bug in GCC 3.0.2, but I need some
> insight.
This is not an optimizer bug, it's a known side effect of your
incorrect usage of the asm() statement. The input/output register
lists in your asm()'s inherently claim that putting values into
variables before.half.lo and .hi is _all_ this assembly statement
does. But that's wrong. They also modify the machine's status in a
way that influences the next such statement.
> asm("rdtsc" : "=a" (before.half.lo), "=d" (before.half.hi));
> delay(1000); // pause for 1 second
> asm("rdtsc" : "=a" (after.half.lo), "=d" (after.half.hi));
What happens is that you made a promise to the compiler, but didn't
keep it. Now you bear the consequences from that.
Short of flagging these asm block volatile (or whatever GCC 3 does for
that), I think you would at least have to add "memory" to the input or
clobber list of one or both, to stop the optimizer from removing one
of these statements. It has to be told that the first modifies the
status of the machine besides those two variables, and the second
reads that status.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -