avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] Volatile not working?


From: Ron
Subject: [avr-libc-dev] Volatile not working?
Date: Mon, 8 Jan 2007 17:22:07 +1100

Hi Folks. I would have thought that with -Os the code below should work.

static volatile char* Ptr;
   .
   .
static Send(char* p)
{
   if (p)
   {
      while (Ptr != NULL) {;}
      Ptr = p;
      UDR1 = *Ptr++;
   }
}
   .
   .
SIGNAL(SIG_UART1_TRANS)
{
   if (*Ptr == '\0')
      Ptr = NULL;
   else
      UDR1 = *Ptr++;
}

However, the while loop becomes:

       LDS    R24,0x018D
       LDS    R25,0x018E
       SBIW   R24,0x00
       BRNE   PC-0x01

The code is as expected with -O0. Version is 3.4.6. Something I'm
missing?

Ron






reply via email to

[Prev in Thread] Current Thread [Next in Thread]