[fpc-devel] volatile variables

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Jun 28 18:11:29 CEST 2011


Andrew Brunner schrieb:
> On Tue, Jun 28, 2011 at 9:23 AM, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
> 
> On topic, Jonas can you take a few moments to describe how developers
> can force code execution in order w/o using a third party library?  Is
> there a compiler directive we can use?

I think that you should give at least an example, where instruction 
reordering makes a difference. Neither a compiler nor a processor is 
allowed to reorder instructions in a way, that breaks the def/use 
(produce/consume...) chain (see SSA - Single Static Assignment).

No library will prevent you from implementing undetectable side-effects, 
or to use alias.

When in this code snippet
   list.Add(x);
   i := list.Count;
the statements cannot be executed out-of-sequence, or in parallel, then 
I assume that every subroutine call will disallow to move instructions 
from after the call to before it. Everything else would be insane.

DoDi




More information about the fpc-devel mailing list