This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/41849] New: optimization fails when register variables are used for an interrupt
- From: "hendrixgr at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Oct 2009 19:27:50 -0000
- Subject: [Bug rtl-optimization/41849] New: optimization fails when register variables are used for an interrupt
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
If i use global register variables that are used and updated inside an
interrupt the optimizer produces broken code.
Code example:
register volatile unsigned char timer0_h8 asm("r3");
volatile unsigned char timer0_h8_buf = 0;
void foo(void)
{
timer0_h8_buf = timer0_h8;
return;
}
ISR(TIMER0_OVF_vect)
{
timer0_h8++;
}
produces:
2432 0b5a 1092 0000 sts timer0_h8_buf,__zero_reg__ ; timer0_h8_buf,
instead of this when no optimization is used:
3248 104a 832D mov r24,r3 ; timer0_h8.47, timer0_h8
3249 104c 8093 0000 sts timer0_h8_buf,r24 ; timer0_h8_buf,
timer0_h8.47
--
Summary: optimization fails when register variables are used for
an interrupt
Product: gcc
Version: 4.4.2
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hendrixgr at gmail dot com
GCC build triplet: Linux i386
GCC host triplet: Linux ubuntu 9.04
GCC target triplet: avr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41849