https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65507
Bug ID: 65507 Summary: avr-gcc -f-merge-all-constants causes internal compiler error in get_section, at varasm.c:312 Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dfnsonfsduifb at gmx dot de Compiler: Using built-in specs. COLLECT_GCC=/home/joe/bin/gcc/avr/bin/avr-gcc COLLECT_LTO_WRAPPER=/home/joe/bin/gcc/avr/libexec/gcc/avr/4.8.1/lto-wrapper Target: avr Configured with: ../configure --prefix=/home/joe/bin/gcc/avr/ --with-gnu-ld --with-gnu-as --with-dwarf2 --disable-werror --disable-threads --disable-nls --disable-shared --disable-libssp --disable-libmudflap --disable-libgomp --target=avr --enable-languages=c --with-system-zlib --enable-target-optspace Thread model: single gcc version 4.8.1 (GCC) Running on Linux, x86_64. avr-libc v1.8.0. Complete test program that demonstrates the problem: #include <stdio.h> #include <avr/pgmspace.h> volatile int running; void foobar() { char lcdText[33]; const char *pgmstr = running ? PSTR("Run!") : PSTR("STOP"); snprintf(lcdText, 32, "%4S", pgmstr); } Description of problem: When this is compiled with -fmerge-all-constants, a internal compiler error is triggered. The example compiles successfully without -fmerge-all-constants. $ avr-gcc -mmcu=atmega128 -fmerge-all-constants -c -o crap crap.c crap.c:10:1: internal compiler error: in get_section, at varasm.c:312 } ^ 0x90611f get_section(char const*, unsigned int, tree_node*) ../../gcc/varasm.c:312 0x91da3f avr_asm_select_section ../../gcc/config/avr/avr.c:8368 0x90e83a assemble_variable(tree_node*, int, int, int) ../../gcc/varasm.c:2013 0x910205 varpool_assemble_decl(varpool_node*) ../../gcc/varpool.c:313 0x578478 output_in_order ../../gcc/cgraphunit.c:1837 0x578478 compile() ../../gcc/cgraphunit.c:2037 0x578689 finalize_compilation_unit() ../../gcc/cgraphunit.c:2119 0x4b5383 c_write_global_declarations() ../../gcc/c/c-decl.c:10118 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.