aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-common.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2004-09-07 07:43:37 -0700
committerPaul Brook <pbrook@gcc.gnu.org>2004-09-07 14:43:37 +0000
commitc8cc8542fa03e78ff3a39734f5dad49b233be54f (patch)
tree52dd9f205592562d8c793717e022109001b07465 /gcc/fortran/trans-common.c
parent5212068fdf32944f8a35909cd5e9eb8d420fbc76 (diff)
downloadgcc-c8cc8542fa03e78ff3a39734f5dad49b233be54f.zip
gcc-c8cc8542fa03e78ff3a39734f5dad49b233be54f.tar.gz
gcc-c8cc8542fa03e78ff3a39734f5dad49b233be54f.tar.bz2
error.c (show_locus): Handle mapped locations.
2004-09-07 Per Bothner <per@bothner.com> Paul Brook <paul@codesourcery.com> * error.c (show_locus): Handle mapped locations. * f95-lang.c (gfc_be_parse_file): Initialize mapped locations. * gfortran.h: Include input.h. (struct gfc_linebuf): Use source_location. * scanner.c (get_file): Initialize linemap. (preprocessor_line): Pass extra argument to get_file. (load_file): Ditto. Setup linemap. (gfc_new_file): Handle mapped locations. * trans-common.c (build_field, build_equiv_decl, build_common_decl): Set decl source locations. (gfc_trans_common): Set blank common block location. * trans-decl.c (gfc_set_decl_location): New function. (gfc_get_label_decl, gfc_get_symbol_decl): Use it. (trans_function_start): Move call to gfc_set_backend_locus.. (build_function_decl): ... to here. (build_entry_thunks): Set and restore the backend locus. (gfc_generate_constructors): Remove excess arguments to init_function_start. (gfc_generate_block_data): Add comments. Set the decl locus. * trans-io.c (set_error_locus): Handle mapped locations. * trans.c (gfc_get_backend_locus, gfc_get_backend_locus): Ditto. (gfc_trans_code): Use SET_EXPR_LOCATION. (gfc_generate_code): Override the location of the new symbol. * trans.h (gfc_set_decl_location): Add prototype. Co-Authored-By: Paul Brook <paul@codesourcery.com> From-SVN: r87142
Diffstat (limited to 'gcc/fortran/trans-common.c')
-rw-r--r--gcc/fortran/trans-common.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 69cb1a3..f9db554 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -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);
}