-fdata-sections and an attribute cause internal error

Bug #1329080 reported by Sasha Slijepcevic
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
New
Undecided
Unassigned

Bug Description

The following small file causes an internal error when compiled with Linaro GCC for Arm 4.9, on Linux x86 (64 bit):
const int echo = 5;
const int echo __attribute__ ((externally_visible));

int main(int argc, char* argv[])
{
    return (echo);
}

Here is the command line and the output:
/work/gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux/bin/arm-linux-gnueabihf-gcc -I. -I/work/gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux/include -c -fPIC -O2 -ffunction-sections -fdata-sections main.c
main.c:2:1: internal compiler error: in get_variable_section, at varasm.c:1095
 const int echo __attribute__ ((externally_visible));
 ^
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.launchpad.net/gcc-linaro> for instructions.

If the option -fdata-sections is omitted, the compilation succeeds. The same problem shows up with Linaro GCC for Arm 4.7 and 4.8, but not with x86 versions of GCC.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.