Problem with too good optimization
Kai Schaeffer (kschaeffer@schaeffer-apparatebau.de)
Mon, 01 Nov 1999 19:04:43 +0100
Hi,
I have a little Problem, with the optimization of the gcc (m68k, version
2.8.1). I want to wait until a value of a variable changes. So I write
something like that:
char c;
test()
{
c=1;
while(c);
}
The changing of 'c' happens in an interrupt routine. If I turn the
optimization with -O2 on, the compiler produces code like this:
move.b c,%d0
.L6:
tst.b %d0
jbne .L6
Of course the programm doesn't notice the changing of the value of 'c'. Are
there any arguments for a variable that the compiler doesn't use a register?
I habe the same problem, if I want to wait until a bit changes on a port:
#define PORTE (*(char*)0xFFF...)
test()
{
while (PORTE & 0x20);
}
Greetings
Kai
-------------------------------------------------------
Dipl.-Phys. Kai Schaeffer Schaeffer Apparatebau KG
Pasewaldtstr. 7 Tel. +49-30-80902151
14169 Berlin FAX: +49-30-80902153
http://www.schaeffer-apparatebau.de
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com