[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Is this a Bug??????
From: |
Geoffrey Wossum |
Subject: |
Re: [avr-gcc-list] Is this a Bug?????? |
Date: |
Wed, 31 Jul 2002 08:43:58 -0500 (CDT) |
> C code
> _________________________________________
> cbi( PORTB, 0 ); // sos send
> while( timer_flag == 0 ); //wait for timer
> cbi( PORTB, 1 ); // seakey send
> In the assembley code, the variable 'timer_flag'
> gets put into register r24 and then gets tested
> repetedly. The value of timer_flag never gets
> reloaded into r24 the program hangs.
You must declare timer_flag as volatile, otherwise the compiler will make
the optimization you observed.
---
Geoffrey Wossum
Project AKO - http://ako.sf.net
avr-gcc-list at http://avr1.org