------- Comment #11 from amodra at bigpond dot net dot au 2007-09-26 14:27 ------- We first choose a section here, when decl readonly_flag is false:
#0 get_section (name=0x40000cca824 ".data._ZSt15system_category", flags=512, decl=0x40000e44000) at /src/gcc-current/gcc/varasm.c:527 #1 0x000000001067bd70 in get_block_for_decl (decl=0x40000e44000) at /src/gcc-current/gcc/varasm.c:1196 #2 0x000000001067c588 in make_decl_rtl (decl=0x40000e44000) at /src/gcc-current/gcc/varasm.c:1395 #3 0x000000001067d3d8 in notice_global_symbol (decl=0x40000e44000) at /src/gcc-current/gcc/varasm.c:1558 #4 0x00000000106dd04c in varpool_mark_needed_node (node=0x40000f12500) at /src/gcc-current/gcc/varpool.c:192 #5 0x00000000106dda78 in varpool_finalize_decl (decl=0x40000e44000) at /src/gcc-current/gcc/varpool.c:297 #6 0x0000000010403fac in rest_of_decl_compilation (decl=0x40000e44000, top_level=1, at_end=0) at /src/gcc-current/gcc/passes.c:192 #7 0x000000001002c624 in make_rtl_for_nonlocal_decl (decl=0x40000e44000, init=0x0, asmspec=0x10b4f398 "") at /src/gcc-current/gcc/cp/decl.c:5136 #8 0x000000001003e1ec in cp_finish_decl (decl=0x40000e44000, init=0x0, init_const_expr_p=0 '\0', asmspec_tree=<value optimized out>, flags=8) at /src/gcc-current/gcc/cp/decl.c:5511 Note flags=512 is SECTION_WRITE in get_section call. We set readonly near the end of cp_finish_decl. This change in the readonly flag is the cause of later trouble when assemble_variable is called, as targetm.section_type_flags (called from get_named_section, from get_variable_section, from assemble_variable) now returns 0. get_section is then called with flags=0, triggering the error. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33168