https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67868

            Bug ID: 67868
           Summary: [4.9/5/6 regression] ICE on targets with section
                    anchors.
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ramana at gcc dot gnu.org
  Target Milestone: ---

Given this testcase on targets with section anchors. I see the  following ICE
on arm, aarch64 and powerpc targets.

$> cat /tmp/test.c
char _vtable_map_vars_start []
__attribute__ ((__visibility__ ("protected"), used, aligned(4096),
  section(".vtable_map_vars")))
  = { };

$> ./xgcc -B`pwd` -S -O2 /tmp/test.c

/tmp/test.c:5:3: internal compiler error: Segmentation fault
   = { };
   ^
0xa95d6f crash_signal
        ../../gcc-fsf/gcc/toplev.c:353
0xd6faec tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../gcc-fsf/gcc/tree.h:2863
0xd6faec default_elf_asm_named_section(char const*, unsigned int, tree_node*)
        ../../gcc-fsf/gcc/varasm.c:6303
0xd7191f switch_to_section(section*)
        ../../gcc-fsf/gcc/varasm.c:7144
0xd75603 output_object_block
        ../../gcc-fsf/gcc/varasm.c:7335
0xd75603 output_object_blocks()
        ../../gcc-fsf/gcc/varasm.c:7440
Please submit a full bug report,
with preprocessed source if appropriate.

The reason for the failure appears to be a failure to handle VAR_DECLS in
default_elf_asm_named_section.  Given that switch_to_section essentially passes
a VAR_DECL or a FUNCTION_DECL into targetm.elf_asm_named_section while
targetm.elf_asm_named_section only handles IDENTIFIER_NAMES in it, there is a
clear mismatch in terms of what is passed and what is expected.

I've got a patch that I'm currently testing.

Reply via email to