This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/34736] New: AVR optimiser does not keep interrupt disabled blocks small
- From: "gcc-david at tulloh dot id dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Jan 2008 06:03:45 -0000
- Subject: [Bug c/34736] New: AVR optimiser does not keep interrupt disabled blocks small
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I am compiling for an avr target and sharing variables with interrupts. To
safely update the variables I am disabling interrupts but I want the interrupts
to be disabled for the shortest possible period of time.
The compiler shifts the instructions around slightly when optimizing, this has
the effect of increasing the time that interrupts are disabled. I've attached
a trivial example which demonstrates this however more complicated code has a
similar result with a varying number of instructions moved into the disabled
section.
I'm attaching a trivial example with .c, .i (typedefs trimmed) and .s files.
The gcc used is from the Debian gcc-avr package version 4.2.2-1
Compilation line was:
avr-gcc -mmcu=attiny13 -Wall -Os -fsigned-char -S -c -o interrupt_disable_bug.s
interrupt_disable_bug.c
--
Summary: AVR optimiser does not keep interrupt disabled blocks
small
Product: gcc
Version: 4.2.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcc-david at tulloh dot id dot au
GCC target triplet: AVR
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34736