http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50255
--- Comment #6 from Stephan Bergmann <stephan.bergmann.secondary at googlemail dot com> 2011-09-02 13:15:42 UTC --- While I still don't have a stripped down test case, I at least know now what is going wrong (on recent gcc-4_6-branch rev 178396, at least): When compiling vbasheetobjects.cxx, the text section for the non-virtual thunk (with section name ".text._ZN19..." and group name "_ZThn20_N19...") is first obtained at get_section() hot_function_section() function_section_1() function_section_1() assemble_start_function() assemble_thunk() cgraph_expand_function() cgraph_expand_all_functions() cgraph_optimize() cgraph_finalize_compilation_unit() cp_write_global_declarations() compile_file() do_compile() toplev_main() main() There, get_section() is called with decl pointing to the thunk, as assemble_thunk() sets global current_function_decl = thunk_fndecl; Later on, the corresponding rodata section for the non-virtual thunk (with section name ".rodata._ZN19..." and erroneous group name "_ZN19..." instead of "_ZThn20_N19...") is first obtained at get_section() default_function_rodata_section() final_scan_insn() final() rest_of_handle_final() execute_one_pass() execute_pass_list() execute_pass_list() execute_pass_list() tree_rest_of_compilation() cgraph_expand_function() ... a few lines further down in the same invocation of cgraph_expand_function() (and in final_scan_insn() we are at switch_to_section(targetm.asm_out.function_rodata_section(current_function_decl));). But this time, current_function_decl points to the function itself, not the non-virtual thunk, as tree_rest_of_compilation() sets current_function_decl = fndecl;