aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-common.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2005-10-12 08:18:12 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2005-10-12 08:18:12 +0200
commit81871c2a0501a25b3f038286268e0ce84936fdf2 (patch)
tree178dc578bf72c1c0badbd660ff2e0ed2e152ac89 /gcc/fortran/trans-common.c
parent595cf76b1f7e63889c5a0cc9b09163c0264d2e25 (diff)
downloadgcc-81871c2a0501a25b3f038286268e0ce84936fdf2.zip
gcc-81871c2a0501a25b3f038286268e0ce84936fdf2.tar.gz
gcc-81871c2a0501a25b3f038286268e0ce84936fdf2.tar.bz2
trans-common.c (build_field): Fix comment typo.
* trans-common.c (build_field): Fix comment typo. (create_common): Set backend_decl of COMMON or EQUIVALENCEd variables to a VAR_DECL with the COMPONENT_REF in DECL_HAS_VALUE_EXPR rather than COMPONENT_REF directly. * f95-lang.c (gfc_expand_function): Emit debug info for EQUIVALENCEd variables if the equiv union is going to be output. From-SVN: r105288
Diffstat (limited to 'gcc/fortran/trans-common.c')
-rw-r--r--gcc/fortran/trans-common.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index de47f90..ebd7f52 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -241,7 +241,7 @@ build_field (segment_info *h, tree union_type, record_layout_info rli)
DECL_FIELD_OFFSET (field),
DECL_SIZE_UNIT (field)));
/* If this field is assigned to a label, we create another two variables.
- One will hold the address of taget label or format label. The other will
+ One will hold the address of target label or format label. The other will
hold the length of format label string. */
if (h->sym->attr.assign)
{
@@ -471,8 +471,38 @@ create_common (gfc_common_head *com, segment_info * head, bool saw_equiv)
/* Build component reference for each variable. */
for (s = head; s; s = next_s)
{
- s->sym->backend_decl = build3 (COMPONENT_REF, TREE_TYPE (s->field),
- decl, s->field, NULL_TREE);
+ tree var_decl;
+
+ var_decl = build_decl (VAR_DECL, DECL_NAME (s->field),
+ TREE_TYPE (s->field));
+ gfc_set_decl_location (var_decl, &s->sym->declared_at);
+ TREE_PUBLIC (var_decl) = TREE_PUBLIC (decl);
+ TREE_STATIC (var_decl) = TREE_STATIC (decl);
+ TREE_USED (var_decl) = TREE_USED (decl);
+ if (s->sym->attr.target)
+ TREE_ADDRESSABLE (var_decl) = 1;
+ /* This is a fake variable just for debugging purposes. */
+ TREE_ASM_WRITTEN (var_decl) = 1;
+
+ if (com)
+ var_decl = pushdecl_top_level (var_decl);
+ else
+ gfc_add_decl_to_function (var_decl);
+
+ SET_DECL_VALUE_EXPR (var_decl,
+ build3 (COMPONENT_REF, TREE_TYPE (s->field),
+ decl, s->field, NULL_TREE));
+ DECL_HAS_VALUE_EXPR_P (var_decl) = 1;
+
+ if (s->sym->attr.assign)
+ {
+ gfc_allocate_lang_decl (var_decl);
+ GFC_DECL_ASSIGN (var_decl) = 1;
+ GFC_DECL_STRING_LEN (var_decl) = GFC_DECL_STRING_LEN (s->field);
+ GFC_DECL_ASSIGN_ADDR (var_decl) = GFC_DECL_ASSIGN_ADDR (s->field);
+ }
+
+ s->sym->backend_decl = var_decl;
next_s = s->next;
gfc_free (s);