|problems with "reordered code" using GNU, PPC, vxWorks email@example.com (2003-03-24)|
|Re: problems with "reordered code" using GNU, PPC, vxWorks firstname.lastname@example.org (2003-03-30)|
|Re: problems with "reordered code" using GNU, PPC, vxWorks email@example.com (2003-03-30)|
|Re: problems with "reordered code" using GNU, PPC, vxWorks firstname.lastname@example.org (Michael Meissner) (2003-03-30)|
|From:||email@example.com (Allen McIntosh)|
|Date:||30 Mar 2003 00:35:25 -0500|
|Posted-Date:||30 Mar 2003 00:35:25 EST|
Wolfgang Schulze <firstname.lastname@example.org> wrote:
>I´m using a PPC under vxworks, Ansi C, GNU. After compilation my code
>is reordered for optimisation. I want to have my code optimized by the
>compiler, but in some source code I need to have the exact instruction
>order as I write in my source code.
You could try turning peephole optimization off (I think there is a
gcc option for this) for the critical files, or turning optimization
The C standard gives the compiler some latitude in re-ordering
operations. There is not a whole lot you can do about it, unless the
compiler gives you something like "noreorder".
>[Isn't that what volatile declarations are supposed to do? -John]
volatile int a;
volatile int b;
Must the compiler fetch a before b? It's been a looong time since
I did this sort of thing, so I'll defer to anyone who has read
the standard recently.
[No, because + isn't a sequence point. But this is sequenced:
t = a; /* semicolon is sequence point */
t += b;
Return to the
Search the comp.compilers archives again.