On Friday, December 07, 2007 5:24 PM, David Kelly wrote: > The compiler won't read PINB using the above. > > In general on AVR when one reads PORTB one reads the output latchs, in > other words the last value written. On other CPU's this same > action may > read the input buffers. AVR provids PIN ports for specifically reading > the state of the external pins. > > Using -O1 the above exclusive-or-equals generates exactly the > same code > as the OP first wrote: > > PORTB = ~PORTB; > 3ee: 85 b1 in r24, 0x05 ; 5 > 3f0: 80 95 com r24 > 3f2: 85 b9 out 0x05, r24 ; 5 > PORTB ^= 0xff; > 3f4: 85 b1 in r24, 0x05 ; 5 > 3f6: 80 95 com r24 > 3f8: 85 b9 out 0x05, r24 ; 5 This result is unambiguous. The question is: Is this a bug which means a bug report is necessary or is it a feature that needs to be described? It would be comfortable if GCC could distinguish between the IO-ports and other IO-variables were the in and out address are identical.
Knut _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list