AnsweredAssumed Answered

Code reordering due to optimizations

Question asked by Achim Daub on Nov 30, 2015
Latest reply on Dec 16, 2015 by Carlos_Mendoza

Does the CodeWarrior C/C++ Compiler for ColdFire (Version 6.4) reorder a sequence of a volatile access and a call to the c standard library?

If we have the following c code:

     {

          volatile int i = 0;

          ...

          i = 3;

          memcpy( ... );

          ...

     }

Is it possible that the compiler is reordering the statements due to optimization?

     {

          volatile int i = 0;

          ...

          memcpy( ... );

          i = 3;

          ...

     }

 

Is there a recommended way to generate a compiler or memory barrier with the CodeWarrior C/C++ Compiler for ColdFire?

Outcomes