Binary files origsrc/gcc-7.3.0/gcc/fortran/.trans-decl.c.swp and src/gcc-7.3.0/gcc/fortran/.trans-decl.c.swp differ --- origsrc/gcc-7.3.0/gcc/fortran/trans-common.c 2017-01-09 00:42:09.155312000 +0100 +++ src/gcc-7.3.0/gcc/fortran/trans-common.c 2018-10-27 17:55:33.219386300 +0200 @@ -102,6 +102,7 @@ along with GCC; see the file COPYING3. #include "trans.h" #include "stringpool.h" #include "fold-const.h" +#include "attribs.h" #include "stor-layout.h" #include "varasm.h" #include "trans-types.h" @@ -423,6 +424,8 @@ build_common_decl (gfc_common_head *com, /* If there is no backend_decl for the common block, build it. */ if (decl == NULL_TREE) { + tree attributes; + if (com->is_bind_c == 1 && com->binding_label) decl = build_decl (input_location, VAR_DECL, identifier, union_type); else @@ -454,6 +457,13 @@ build_common_decl (gfc_common_head *com, gfc_set_decl_location (decl, &com->where); +/* check equivalence + attributes = gfc_add_attributes_to_decl (common_sym->attr, NULL_TREE); +*/ + attributes = gfc_add_attributes_to_decl (com->head->attr, NULL_TREE); + decl_attributes (&decl, attributes, 0); + + if (com->threadprivate) set_decl_tls_model (decl, decl_default_tls_model (decl)); --- origsrc/gcc-7.3.0/gcc/fortran/trans-decl.c 2017-11-13 21:01:20.128076000 +0100 +++ src/gcc-7.3.0/gcc/fortran/trans-decl.c 2018-10-27 18:01:19.857314000 +0200 @@ -1403,46 +1403,6 @@ gfc_add_assign_aux_vars (gfc_symbol * sy } -static tree -add_attributes_to_decl (symbol_attribute sym_attr, tree list) -{ - unsigned id; - tree attr; - - for (id = 0; id < EXT_ATTR_NUM; id++) - if (sym_attr.ext_attr & (1 << id)) - { - attr = build_tree_list ( - get_identifier (ext_attr_list[id].middle_end_name), - NULL_TREE); - list = chainon (list, attr); - } - - if (sym_attr.omp_declare_target_link) - list = tree_cons (get_identifier ("omp declare target link"), - NULL_TREE, list); - else if (sym_attr.omp_declare_target) - list = tree_cons (get_identifier ("omp declare target"), - NULL_TREE, list); - - if (sym_attr.oacc_function) - { - tree dims = NULL_TREE; - int ix; - int level = sym_attr.oacc_function - 1; - - for (ix = GOMP_DIM_MAX; ix--;) - dims = tree_cons (build_int_cst (boolean_type_node, ix >= level), - integer_zero_node, dims); - - list = tree_cons (get_identifier ("oacc function"), - dims, list); - } - - return list; -} - - static void build_function_decl (gfc_symbol * sym, bool global); @@ -1689,7 +1649,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) VAR_DECL, gfc_sym_identifier (sym), gfc_sym_type (sym)); /* Add attributes to variables. Functions are handled elsewhere. */ - attributes = add_attributes_to_decl (sym->attr, NULL_TREE); + attributes = gfc_add_attributes_to_decl (sym->attr, NULL_TREE); decl_attributes (&decl, attributes, 0); /* Symbols from modules should have their assembler names mangled. @@ -1921,7 +1881,7 @@ get_proc_pointer_decl (gfc_symbol *sym) && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) set_decl_tls_model (decl, decl_default_tls_model (decl)); - attributes = add_attributes_to_decl (sym->attr, NULL_TREE); + attributes = gfc_add_attributes_to_decl (sym->attr, NULL_TREE); decl_attributes (&decl, attributes, 0); return decl; @@ -2114,7 +2074,7 @@ module_sym: DECL_EXTERNAL (fndecl) = 1; TREE_PUBLIC (fndecl) = 1; - attributes = add_attributes_to_decl (sym->attr, NULL_TREE); + attributes = gfc_add_attributes_to_decl (sym->attr, NULL_TREE); decl_attributes (&fndecl, attributes, 0); gfc_set_decl_assembler_name (fndecl, mangled_name); @@ -2221,7 +2181,7 @@ build_function_decl (gfc_symbol * sym, b if (sym->attr.referenced || sym->attr.entry_master) TREE_USED (fndecl) = 1; - attributes = add_attributes_to_decl (attr, NULL_TREE); + attributes = gfc_add_attributes_to_decl (attr, NULL_TREE); decl_attributes (&fndecl, attributes, 0); /* Figure out the return type of the declared function, and build a @@ -6647,5 +6607,43 @@ gfc_process_block_locals (gfc_namespace* saved_local_decls = NULL_TREE; } +tree +gfc_add_attributes_to_decl (symbol_attribute sym_attr, tree list) +{ + unsigned id; + tree attr; + + for (id = 0; id < EXT_ATTR_NUM; id++) + if (sym_attr.ext_attr & (1 << id)) + { + attr = build_tree_list ( + get_identifier (ext_attr_list[id].middle_end_name), + NULL_TREE); + list = chainon (list, attr); + } + + if (sym_attr.omp_declare_target_link) + list = tree_cons (get_identifier ("omp declare target link"), + NULL_TREE, list); + else if (sym_attr.omp_declare_target) + list = tree_cons (get_identifier ("omp declare target"), + NULL_TREE, list); + + if (sym_attr.oacc_function) + { + tree dims = NULL_TREE; + int ix; + int level = sym_attr.oacc_function - 1; + + for (ix = GOMP_DIM_MAX; ix--;) + dims = tree_cons (build_int_cst (boolean_type_node, ix >= level), + integer_zero_node, dims); + + list = tree_cons (get_identifier ("oacc function"), + dims, list); + } + + return list; +} #include "gt-fortran-trans-decl.h" --- origsrc/gcc-7.3.0/gcc/fortran/trans-types.h 2017-11-13 21:01:20.128076000 +0100 +++ src/gcc-7.3.0/gcc/fortran/trans-types.h 2018-10-27 16:22:52.225379600 +0200 @@ -98,6 +98,8 @@ tree gfc_get_array_type_bounds (tree, in enum gfc_array_kind, bool); tree gfc_get_nodesc_array_type (tree, gfc_array_spec *, gfc_packed, bool); +tree gfc_add_attributes_to_decl (symbol_attribute sym_attr, tree list); + /* Add a field of given name and type to a UNION_TYPE or RECORD_TYPE. */ tree gfc_add_field_to_struct (tree, tree, tree, tree **);