[Bug lto/79061] [7 Regression][LTO][ASAN] LTO plus ASAN fails with "AddressSanitizer: initialization-order-fiasco"
m.ostapenko at samsung dot com
gcc-bugzilla@gcc.gnu.org
Mon Jan 16 08:44:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79061
--- Comment #8 from Maxim Ostapenko <m.ostapenko at samsung dot com> ---
(In reply to Jakub Jelinek from comment #7)
> Comment on attachment 40514 [details]
> Untested fix 1.
>
> But DECL_SOURCE_FILE is not the main input file of the TU that contains it,
> if e.g. a variable is defined in a header.
> Can't you find the corresponding TRANSLATION_UNIT_DECL (see e.g. how
> dwarf2out.c is_cxx now looks for that) and get the name from that?
> And, the multiple ?s look just weird, (in_lto_p && something ? something :
> main_input_filename); would be nicer.
Yes, but with following helper (extracted from is_cxx) I get DECL_NAME
(translation_unit_decl) == NULL:
static const_tree
get_translation_unit_decl (tree decl)
{
const_tree context = decl;
while (context && TREE_CODE (context) != TRANSLATION_UNIT_DECL)
{
if (TREE_CODE (context) == BLOCK)
context = BLOCK_SUPERCONTEXT (context);
else
context = get_containing_scope (context);
}
return context;
}
and from gdb:
Breakpoint 1, asan_add_global (decl=0x7ffff7ff7f30, type=0x7ffff658df18,
v=0x7ffff659d2d0) at /home/max/workspace/downloads/gcc/gcc/asan.c:2410
2410 const_tree translation_unit_decl = get_translation_unit_decl (decl);
(gdb) n
2411 if (translation_unit_decl)
(gdb) call debug_tree(translation_unit_decl)
<translation_unit_decl 0x7ffff63e4168 D.1 VOID file (null) line 0 col 0
align 1>
(gdb)
More information about the Gcc-bugs
mailing list