Program: __attribute__ ((naked)) int main(void) { return 0; } Compiled with 4.1.1 for the AVR target: Compiling C: test.c avr-gcc -c -mmcu=atmega128 -I. -gdwarf-2 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./test.lst -std=gnu99 -Wundef -MMD -MP -MF .dep/test.o.d test.c -o test.o test.c:2: internal compiler error: in start_function, at c-decl.c:6014 Please submit a full bug report, A program with the proper syntax, compiles without error: int main(void) __attribute__ ((naked)); int main(void) { return 0; }
I disagree the "invalid syntax". According to the formal attribute syntax description: ``Any list of specifiers and qualifiers at the start of a declaration may contain attribute specifiers, whether or not such a list may in that context contain storage class specifiers.'' it is a perfectly valid use. Syntactically, the ``int main(void)'' part of that function definition is a declarator, so it essentially combines a declaration with a definition.
Created attachment 13733 [details] Patch to fix bug, written by Anatoly Sokolov
The attached patch, written by Anatoly Sokolov, fixes the bug.
*** Bug 32517 has been marked as a duplicate of this bug. ***
Subject: Bug 31331 Author: aesok Date: Wed Jul 4 21:10:28 2007 New Revision: 126337 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126337 Log: PR target/31331 * config/avr/avr.c (avr_naked_function_p): Handle receiving a type rather than a decl. (avr_attribute_table): Make "naked" attribute apply to function types rather than to decls. (avr_handle_fntype_attribute): New function. Modified: trunk/gcc/ChangeLog trunk/gcc/config/avr/avr.c
Subject: Bug 31331 Author: aesok Date: Sat Jul 7 19:30:37 2007 New Revision: 126446 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126446 Log: PR target/31331 * config/avr/avr.c (avr_naked_function_p): Handle receiving a type rather than a decl. (avr_attribute_table): Make "naked" attribute apply to function types rather than to decls. (avr_handle_fntype_attribute): New function. Modified: branches/gcc-4_2-branch/gcc/ChangeLog branches/gcc-4_2-branch/gcc/config/avr/avr.c
Fixed.
Subject: Bug 31331 Author: aesok Date: Sat Jul 7 19:39:36 2007 New Revision: 126447 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126447 Log: PR target/31331 * config/avr/avr.c (avr_naked_function_p): Handle receiving a type rather than a decl. (avr_attribute_table): Make "naked" attribute apply to function types rather than to decls. (avr_handle_fntype_attribute): New function. Modified: branches/gcc-4_1-branch/gcc/ChangeLog branches/gcc-4_1-branch/gcc/config/avr/avr.c
*** Bug 260998 has been marked as a duplicate of this bug. *** Seen from the domain http://volichat.com Page where seen: http://volichat.com/adult-chat-rooms Marked for reference. Resolved as fixed @bugzilla.