public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "stefan dot dreyer at yahoo dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/42240] New: wrong Epilog on nacked function Date: Tue, 01 Dec 2009 16:18:00 -0000 [thread overview] Message-ID: <bug-42240-18514@http.gcc.gnu.org/bugzilla/> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 3055 bytes --] Hello! Following code is Producing an infinit loop, so main() is never reached extern int main(void); int main(void){ while(1); } #include <avr\io.h> /*Seed aus SRAM Zellen*/ static uint16_t seedram __attribute__ ((section (".noinit"))); void __init_seed(void) __attribute__ ((naked, section (".init8"))); // Bestimme seed aus zufälligem RAM-Inhalt // !!! FUNKTION NICHT AUFRUFEN !!! // !!! FUNKTION WIRD AUTOMATISCH !!! // !!! IN .init8 vor main AUSGEFÜHRT !!! void __init_seed (void) { uint16_t s = 0; uint16_t *p = (uint16_t*) (RAMEND+1); extern uint16_t __noinit_start; while (p >= &__noinit_start + 1) s ^= *(--p); seedram = s; } is going to while (p >= &__noinit_start + 1) 8e: 81 e0 ldi r24, 0x01 ; 1 90: e2 30 cpi r30, 0x02 ; 2 92: f8 07 cpc r31, r24 94: c0 f7 brcc .-16 ; 0x86 <__init_seed+0x12> s ^= *(--p); seedram = s; 96: 30 93 01 01 sts 0x0101, r19 9a: 20 93 00 01 sts 0x0100, r18 } 9e: 20 e0 ldi r18, 0x00 ; 0 a0: 30 e0 ldi r19, 0x00 ; 0 a2: f9 cf rjmp .-14 ; 0x96 <__init_seed+0x22> at line a2: an infinit loop starts and never leaves this function. the Problem is only an Optimation levels O2 and O3 Orginal thread in german Forum: http://www.mikrocontroller.net/topic/158516 compiler call: avr-gcc -c -mmcu=atmega168 -I. -gdwarf-2 -DF_CPU=8000000UL -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./main.lst -std=c99 -MMD -MP -MF .dep/main.o.d main.c -o main.o linker call: avr-gcc -mmcu=atmega168 -I. -gdwarf-2 -DF_CPU=8000000UL -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=main.o -std=c99 -MMD -MP -MF .dep/main.elf.d main.o --output main.elf -Wl,-Map=main.map,--cref -lm Compiler version: D:\Daten\Projekte\Eclipse Workspace\test init>avr-gcc -v Using built-in specs. Target: avr Configured with: ../gcc-4.3.2/configure --enable-win32-registry=WinAVR-20090313 --with-gmp=/usr/local --with-mpfr=/usr/local --prefix=/c/WinAVR --target=avr --enable-languages=c,c++,objc --with-dwarf2 --enable-doc --disable-shared --disable-libada --disable-libssp --disable-nls --with-pkgversion='WinAVR20090313' --with-bugurl='URL:http://sourceforge.net/tracker/?atid=520074&group_id=68108&func=browse'Thread model: single gcc version 4.3.2 (WinAVR 20090313) Greetings Stefan -- Summary: wrong Epilog on nacked function Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: stefan dot dreyer at yahoo dot de GCC host triplet: Windows XP GCC target triplet: AVR http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240
next reply other threads:[~2009-12-01 16:18 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-12-01 16:18 stefan dot dreyer at yahoo dot de [this message] 2009-12-01 16:19 ` [Bug c/42240] " stefan dot dreyer at yahoo dot de 2009-12-01 16:44 ` stefan dot dreyer at yahoo dot de 2009-12-01 16:45 ` stefan dot dreyer at yahoo dot de 2009-12-01 16:46 ` stefan dot dreyer at yahoo dot de 2009-12-01 16:58 ` [Bug target/42240] " j at uriah dot heep dot sax dot de 2009-12-01 19:21 ` [Bug target/42240] wrong epilogue on naked function a dot kaiser at gmx dot net 2009-12-01 19:38 ` a dot kaiser at gmx dot net 2009-12-01 22:50 ` a dot kaiser at gmx dot net 2010-07-22 11:26 ` anitha dot boyapati at atmel dot com 2010-07-26 6:49 ` anitha dot boyapati at atmel dot com 2010-07-26 17:37 ` eric dot weddington at atmel dot com 2010-07-26 17:41 ` [Bug target/42240] [4.3/4.4 Regression, avr] " eric dot weddington at atmel dot com 2010-07-27 11:35 ` anitha dot boyapati at atmel dot com 2010-07-31 10:22 ` [Bug target/42240] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-42240-18514@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).