From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1927 invoked by alias); 10 Oct 2012 14:51:05 -0000 Received: (qmail 1042 invoked by uid 48); 10 Oct 2012 14:50:28 -0000 From: "mojo at world3 dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/54888] New: GCC with -Os is faster than -O3 on some AVR code Date: Wed, 10 Oct 2012 14:51:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mojo at world3 dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-10/txt/msg00982.txt.bz2 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: unassigned@gcc.gnu.org ReportedBy: mojo@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.