[Bug optimization/11181] New: [avr-gcc] Optimization of "uchar/xor/and/single_bit" produced wrong code.
dmixm@marine.febras.ru
gcc-bugzilla@gcc.gnu.org
Fri Jun 13 03:10: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=11181
Summary: [avr-gcc] Optimization of "uchar/xor/and/single_bit"
produced wrong code.
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: dmixm@marine.febras.ru
CC: gcc-bugs@gcc.gnu.org
GCC target triplet: avr-unknown-none
Optimization of next program produced infinite loop:
unsigned char f(void);
void foo(void)
{
while ( ((f() ^ 1) & 1) == 0 ) ;
}
Result is (avr-gcc -W -Wall -O1 -S xor.c):
.file "xor.c"
.arch avr2
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
.global __do_copy_data
.global __do_clear_bss
.text
.global foo
.type foo, @function
foo:
/* prologue: frame size=0 */
push r28
/* prologue end (size=1) */
.L2:
rcall f
rjmp .L2
/* epilogue: frame size=0 */
/* epilogue: noreturn */
/* epilogue end (size=0) */
/* function foo size 3 (2) */
.size foo, .-foo
/* File "xor.c": code 3 = 0x0003 ( 2), prologues 1, epilogues 0 */
More information about the Gcc-bugs
mailing list