public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/65507] New: avr-gcc -f-merge-all-constants causes internal compiler error in get_section, at varasm.c:312
@ 2015-03-21 23:38 dfnsonfsduifb at gmx dot de
2015-03-22 2:22 ` [Bug c/65507] " dfnsonfsduifb at gmx dot de
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: dfnsonfsduifb at gmx dot de @ 2015-03-21 23:38 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/65507] avr-gcc -f-merge-all-constants causes internal compiler error in get_section, at varasm.c:312
2015-03-21 23:38 [Bug c/65507] New: avr-gcc -f-merge-all-constants causes internal compiler error in get_section, at varasm.c:312 dfnsonfsduifb at gmx dot de
@ 2015-03-22 2:22 ` dfnsonfsduifb at gmx dot de
2015-03-22 9:56 ` [Bug target/65507] " maltsevm at gmail dot com
2015-03-30 2:24 ` [Bug target/65507] avr-gcc -fmerge-all-constants " gjl at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: dfnsonfsduifb at gmx dot de @ 2015-03-22 2:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65507
--- Comment #1 from Johannes Bauer <dfnsonfsduifb at gmx dot de> ---
Created attachment 35089
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35089&action=edit
Preprocessed file (-save-temps)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/65507] avr-gcc -f-merge-all-constants causes internal compiler error in get_section, at varasm.c:312
2015-03-21 23:38 [Bug c/65507] New: avr-gcc -f-merge-all-constants causes internal compiler error in get_section, at varasm.c:312 dfnsonfsduifb at gmx dot de
2015-03-22 2:22 ` [Bug c/65507] " dfnsonfsduifb at gmx dot de
@ 2015-03-22 9:56 ` maltsevm at gmail dot com
2015-03-30 2:24 ` [Bug target/65507] avr-gcc -fmerge-all-constants " gjl at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: maltsevm at gmail dot com @ 2015-03-22 9:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65507
Mikhail Maltsev <maltsevm at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |maltsevm at gmail dot com
--- Comment #2 from Mikhail Maltsev <maltsevm at gmail dot com> ---
On current trunk GCC does not ICE, but still sort-of-rejects the valid code.
Reduced testcase:
$ cat ./reduced2.c
void foobar() {
static const char c1[] __attribute__((__progmem__)) = "1",
c2[] __attribute__((__progmem__)) = "2",
c3[] = "3";
}
/opt/binutils-avr/bin/avr-gcc -c -fmerge-all-constants ./reduced2.c
./reduced2.c:5:1: error: section type conflict
}
Despite the error, assembly code (and object file) are still produced, though
it seems to me, that section information gets trashed, but I'm not sure. Looks
like this:
.section .rodata.str1.1,"aMS",@progbits,1
.type c3.1570, @object
.size c3.1570, 2
c3.1570:
.string "3"
.section .progmem.data.str1.1
.type c2.1569, @object
.size c2.1569, 2
c2.1569:
.string "2"
.type c1.1568, @object
.size c1.1568, 2
c1.1568:
.string "1"
Without "-fmerge-all-constants" I get the following:
.size foobar, .-foobar
.section .rodata
.type c3.1570, @object
.size c3.1570, 2
c3.1570:
.string "3"
.section .progmem.data,"a",@progbits
.type c2.1569, @object
.size c2.1569, 2
c2.1569:
.string "2"
.type c1.1568, @object
.size c1.1568, 2
c1.1568:
.string "1"
The problem occurs when GCC tries to get the section for c1 and calls
avr_asm_select_section. This function changes the section name from
".rodata.data.str1.1" to ".progmem.data.str1.1", it then turns out that this
section already exists and the check in varasm.c:get_section fails (both
sections have same flags, SECTION_DECLARED is true, SECTION_OVERRIDE is false,
SECTION_WRITE is false - this all triggers an error).
This comment seems relevant:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43746#c8.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/65507] avr-gcc -fmerge-all-constants causes internal compiler error in get_section, at varasm.c:312
2015-03-21 23:38 [Bug c/65507] New: avr-gcc -f-merge-all-constants causes internal compiler error in get_section, at varasm.c:312 dfnsonfsduifb at gmx dot de
2015-03-22 2:22 ` [Bug c/65507] " dfnsonfsduifb at gmx dot de
2015-03-22 9:56 ` [Bug target/65507] " maltsevm at gmail dot com
@ 2015-03-30 2:24 ` gjl at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: gjl at gcc dot gnu.org @ 2015-03-30 2:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65507
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |gjl at gcc dot gnu.org
Resolution|--- |DUPLICATE
--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Duplicate.
*** This bug has been marked as a duplicate of bug 57597 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-29 22:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-21 23:38 [Bug c/65507] New: avr-gcc -f-merge-all-constants causes internal compiler error in get_section, at varasm.c:312 dfnsonfsduifb at gmx dot de
2015-03-22 2:22 ` [Bug c/65507] " dfnsonfsduifb at gmx dot de
2015-03-22 9:56 ` [Bug target/65507] " maltsevm at gmail dot com
2015-03-30 2:24 ` [Bug target/65507] avr-gcc -fmerge-all-constants " gjl at gcc dot gnu.org
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).