public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "maltsevm at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/65507] avr-gcc -f-merge-all-constants causes internal compiler error in get_section, at varasm.c:312 Date: Sun, 22 Mar 2015 09:56:00 -0000 [thread overview] Message-ID: <bug-65507-4-5iIHFvFyFi@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-65507-4@http.gcc.gnu.org/bugzilla/> 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.
next prev parent reply other threads:[~2015-03-22 5:34 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-03-21 23:38 [Bug c/65507] New: " 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 [this message] 2015-03-30 2:24 ` [Bug target/65507] avr-gcc -fmerge-all-constants " gjl at gcc dot gnu.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-65507-4-5iIHFvFyFi@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).