OSDN Git Service

2004-09-07 Per Bothner <per@bothner.com>
[pf3gnuchains/gcc-fork.git] / gcc / fortran / trans-common.c
index 69cb1a3..f9db554 100644 (file)
@@ -226,6 +226,7 @@ build_field (segment_info *h, tree union_type, record_layout_info rli)
 
   name = get_identifier (h->sym->name);
   field = build_decl (FIELD_DECL, name, h->field);
+  gfc_set_decl_location (field, &h->sym->declared_at);
   known_align = (offset & -offset) * BITS_PER_UNIT;
   if (known_align == 0 || known_align > BIGGEST_ALIGNMENT)
     known_align = BIGGEST_ALIGNMENT;
@@ -268,6 +269,11 @@ build_equiv_decl (tree union_type, bool is_init)
 
   TREE_ADDRESSABLE (decl) = 1;
   TREE_USED (decl) = 1;
+
+  /* The source location has been lost, and doesn't really matter.
+     We need to set it to something though.  */
+  gfc_set_decl_location (decl, &gfc_current_locus);
+
   gfc_add_decl_to_function (decl);
 
   return decl;
@@ -321,6 +327,8 @@ build_common_decl (gfc_common_head *com, tree union_type, bool is_init)
       DECL_ALIGN (decl) = BIGGEST_ALIGNMENT;
       DECL_USER_ALIGN (decl) = 0;
 
+      gfc_set_decl_location (decl, &com->where);
+
       /* Place the back end declaration for this common block in
          GLOBAL_BINDING_LEVEL.  */
       common_sym->backend_decl = pushdecl_top_level (decl);
@@ -797,6 +805,9 @@ gfc_trans_common (gfc_namespace *ns)
   if (ns->blank_common.head != NULL)
     {
       c = gfc_get_common_head ();
+      /* We've lost the real location, so use the location of the
+        enclosing procedure.  */
+      c->where = ns->proc_name->declared_at;
       strcpy (c->name, BLANK_COMMON_NAME);
       translate_common (c, ns->blank_common.head);
     }