This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bug in macro bit_is_set in avr-gcc 3.00


Hi,

Sorry not to use your database, I didn't find a field to specify it is a
avr-gcc bug.

In avr-gcc 2.97, bit_is_set(PORT,BIT) returned 1 if BIT is set, else
returned 0, as it is specified in the document "GNU Development Environment
for the AVR Microcontroller" by Rich Neswold (January 23, 2001).


Now, I use avr-gcc 3.00-20010821 and in this version, bit_is_set(PORT,BIT)
returns BV(BIT)  (I mean 1<< BIT) if it is set.

It is'nt an issue if you use it as follows :
    if(bit_is_set(PORT,BIT))

but it is if you use it like me :
    static char Sample=0;
   Sample= (Sample<<1) + bit_is_set(PORT,BIT);

You need to replace with this:
  Sample= (Sample<<1) + (bit_is_set(PORT,BIT)>>BIT);

Is it a deliberate change or a bug?


regards,

Valery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]