summaryrefslogtreecommitdiffstats
path: root/pr47030.patch
blob: 3ed4dbd3ef349fe4611d6bc48dc2cbfd66cc9c9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
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 **);