[Top][All Lists]

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

Re: [avr-gcc-list] volatile bug in GCC?

From: Rich Neswold
Subject: Re: [avr-gcc-list] volatile bug in GCC?
Date: Sun, 11 Aug 2002 21:37:44 -0500
User-agent: Mutt/1.5.1i

Wasn't it 12-Aug-2002, at 03:37AM, when Janne Heikkinen said:
> volatile char *ptr=NULL;

That's a pointer to a volatile character. If you want a volatile pointer to
a character, move the keyword:

    char * volatile ptr = NULL;

>     while(ptr);


>         lds r24,ptr
>         lds r25,(ptr)+1
> .L5:
>         sbiw r24,0
>         brne .L5

This is correct. It loads the pointer and loops until it's NULL. Did you
want to check to see if the character pointed to becomes non-NULL? Then do

    while (*ptr != '\0');

The compiler seems to be generating the code you asked it to.

 Rich Neswold
 efax: 1.240.536.7092
  web: home.earthlink.net/~rneswold

Attachment: pgpqax_kaEmHT.pgp
Description: PGP signature

reply via email to

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