[Bug optimization/11477] New: writing 0 to memory-location leads to incorrect optimization
gcc-bugzilla at jh42 dot de
gcc-bugzilla@gcc.gnu.org
Wed Jul 9 15:05:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11477
Summary: writing 0 to memory-location leads to incorrect
optimization
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcc-bugzilla at jh42 dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: avr-unknown-none
after writing 0 to a memory-location, the next variable written 0 to is loaded
with the value of the memory-location instead of an immediate load.
compile-options: -g -O1 -Wall -Wstrict-prototypes -mmcu=atmega8515
void main(void) {
unsigned char i;
unsigned char *p = (unsigned char *)0x100;
*p = 0;
i = 0;
while (1) {
*p = i;
}
}
void main(void) {
58: cf e5 ldi r28, 0x5F ; 95
5a: d2 e0 ldi r29, 0x02 ; 2
5c: de bf out 0x3e, r29 ; 62
5e: cd bf out 0x3d, r28 ; 61
unsigned char i;
unsigned char *p = (unsigned char *)0x100;
60: e0 e0 ldi r30, 0x00 ; 0
62: f1 e0 ldi r31, 0x01 ; 1
*p = 0;
64: 10 92 00 01 sts 0x0100, r1
i = 0;
68: 80 91 00 01 lds r24, 0x0100
while (1) {
*p = i;
6c: 80 83 st Z, r24
6e: fe cf rjmp .-4 ; 0x6c
More information about the Gcc-bugs
mailing list