From 71e546870c4afb3c3ff993bd354a98637bcccdc7 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 7 Dec 2015 18:36:54 +0100 Subject: re PR lto/61886 (LTO breaks fread with _FORTIFY_SOURCE=2) PR ipa/61886 * symtab.c (ultimate_transparent_alias_target): New inline function. (symbol_table::assembler_names_equal_p): New method; break out from ... (symbol_table::decl_assembler_name_equal): ... here. (symbol_table::change_decl_assembler_name): Also update names and translation links of transparent aliases. (symtab_node::dump_base): Dump transparent_alias. (symtab_node::verify_base): Implement basic transparent alias verification. (symtab_node::make_decl_local): Support localization of weakrefs; recurse to transparent aliases; set TREE_STATIC. (symtab_node::ultimate_alias_target_1): Handle visibility of transparent aliases. (symtab_node::resolve_alias): New parmaeter transparent; handle transparent aliases; recurse to aliases of aliases to fix comdat groups. (symtab_node::get_partitioning_class): Handle transparent aliases. * ipa-visibility.c (cgraph_externally_visible_p, varpool_node::externally_visible_p): Visibility of transparent alias depends on its target. (function_and_variable_visibility): Do not tweak visibility of transparent laiases. (function_and_variable_visibility): Likewise. * ipa.c (symbol_table::remove_unreachable_nodes): Clear transparent_alias flag. * alias.c (cgraph_node::create_alias, cgraph_node::get_availability): Support transparent aliases. * cgraph.h (symtab_node): Update prototype of resolve_alias; add transparent_alias flag. (symbol_table: Add assembler_names_equal_p. (symtab_node::real_symbol_p): Skip transparent aliases. * cgraphunit.c (cgraph_node::reset): Reset transparent_alias flag. (handle_alias_pairs): Set transparent_alias for weakref. (cgraph_node::assemble_thunks_and_aliases): Do not asemble transparent aliases. * lto-cgraph.c (lto_output_node): When outputting same_comdat_group skip symbols not put into boundary; stream transparent_alias. (lto_output_varpool_node): Likewise. (input_overwrite_node, input_varpool_node): Stream transparent alias. * varpool.c (ctor_for_folding, varpool_node::get_availability, varpool_node::assemble_aliases, symbol_table::remove_unreferenced_decls): Handle transparent aliase. (varpool_node::create_alias): Set transparent_alias. * lto-partition.c (add_symbol_to_partition_1, contained_in_symbol, rename_statics, rename_statics): Handle transparent aliases. From-SVN: r231373 --- gcc/tree.c | 57 +++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 22 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index c8b3ab8..de67c4f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -13423,6 +13423,12 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2, { tree f1, f2; + /* Don't try to compare variants of an incomplete type, before + TYPE_FIELDS has been copied around. */ + if (!COMPLETE_TYPE_P (t1) && !COMPLETE_TYPE_P (t2)) + return true; + + if (TYPE_REVERSE_STORAGE_ORDER (t1) != TYPE_REVERSE_STORAGE_ORDER (t2)) return false; @@ -13709,28 +13715,35 @@ verify_type (const_tree t) } } else if (RECORD_OR_UNION_TYPE_P (t)) - for (tree fld = TYPE_FIELDS (t); fld; fld = TREE_CHAIN (fld)) - { - /* TODO: verify properties of decls. */ - if (TREE_CODE (fld) == FIELD_DECL) - ; - else if (TREE_CODE (fld) == TYPE_DECL) - ; - else if (TREE_CODE (fld) == CONST_DECL) - ; - else if (TREE_CODE (fld) == VAR_DECL) - ; - else if (TREE_CODE (fld) == TEMPLATE_DECL) - ; - else if (TREE_CODE (fld) == USING_DECL) - ; - else - { - error ("Wrong tree in TYPE_FIELDS list"); - debug_tree (fld); - error_found = true; - } - } + { + if (TYPE_FIELDS (t) && !COMPLETE_TYPE_P (t) && in_lto_p) + { + error ("TYPE_FIELDS defined in incomplete type"); + error_found = true; + } + for (tree fld = TYPE_FIELDS (t); fld; fld = TREE_CHAIN (fld)) + { + /* TODO: verify properties of decls. */ + if (TREE_CODE (fld) == FIELD_DECL) + ; + else if (TREE_CODE (fld) == TYPE_DECL) + ; + else if (TREE_CODE (fld) == CONST_DECL) + ; + else if (TREE_CODE (fld) == VAR_DECL) + ; + else if (TREE_CODE (fld) == TEMPLATE_DECL) + ; + else if (TREE_CODE (fld) == USING_DECL) + ; + else + { + error ("Wrong tree in TYPE_FIELDS list"); + debug_tree (fld); + error_found = true; + } + } + } else if (TREE_CODE (t) == INTEGER_TYPE || TREE_CODE (t) == BOOLEAN_TYPE || TREE_CODE (t) == OFFSET_TYPE -- cgit v1.1