http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54888
Bug #: 54888 Summary: GCC with -Os is faster than -O3 on some AVR code Classification: Unclassified Product: gcc Version: 4.3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: m...@world3.net Created attachment 28411 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28411 Compiler output I am using AVR-GCC to write some very low power RTC related code. The interrupt "ISR(RTC_OVF_vect)" executes faster with -Os optimization than it does with -O1, -O2 or -O3. I have measured execution time on an oscilloscope to confirm. V4.3.3 is the one that comes with Atmel Studio / WinAVR. Command line: avr-gcc -funsigned-char -funsigned-bitfields -DF_CPU=8000000UL -O3 -fpack-struct -fshort-enums -g2 -Wall -c -std=gnu99 -MD -MP -MF "rtc.d" -MT"rtc.d" -MT"rtc.o" -mmcu=atxmega128d3 -o"rtc.o" ".././rtc.c" I don't get any warnings etc. when compiling. Build machine is Windows 7 x64. Target is an XMEGA128D3, same issue confirmed with the 128A3U (unsurprisingly). The problem appears to be with GCC, rather than avr-libc, but please correct me if I am wrong.