aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-common.c
diff options
context:
space:
mode:
authorBernhard Fischer <aldot@gcc.gnu.org>2006-11-01 00:38:58 +0100
committerBernhard Reutner-Fischer <aldot@gcc.gnu.org>2006-11-01 00:38:58 +0100
commit4143349751326d2804faad1a7d2cc55e647bd4ad (patch)
treec625ef375d766085812e0b32d7cc941024b9531e /gcc/fortran/trans-common.c
parentaf9d09936281796e6341ad77b210f5a9b257aad3 (diff)
downloadgcc-4143349751326d2804faad1a7d2cc55e647bd4ad.zip
gcc-4143349751326d2804faad1a7d2cc55e647bd4ad.tar.gz
gcc-4143349751326d2804faad1a7d2cc55e647bd4ad.tar.bz2
re PR fortran/29537 (ICE in gfc_match_common for blank common in BLOCK DATA unit)
fortran/ChangeLog: 2006-11-01 Bernhard Fischer <aldot@gcc.gnu.org> PR fortran/29537 * trans-common.c (gfc_trans_common): If the blank common is in a procedure or program without a name then proc_name is null, so use the locus of the common. (gfc_sym_mangled_common_id): Fix whitespace. * match.c (gfc_match_common): Emit warning about blank common in block data. testsuite/ChangeLog: 2006-11-01 Bernhard Fischer <aldot@gcc.gnu.org> PR fortran/29537 * gfortran.dg/blockdata_1.f90: Add warning about blank common in block data. * gfortran.dg/blockdata_2.f90: New testcase. From-SVN: r118347
Diffstat (limited to 'gcc/fortran/trans-common.c')
-rw-r--r--gcc/fortran/trans-common.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 5350eac..83da32f 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -219,7 +219,7 @@ add_segments (segment_info *list, segment_info *v)
/* Construct mangled common block name from symbol name. */
static tree
-gfc_sym_mangled_common_id (const char *name)
+gfc_sym_mangled_common_id (const char *name)
{
int has_underscore;
char mangled_name[GFC_MAX_MANGLED_SYMBOL_LEN + 1];
@@ -1054,13 +1054,18 @@ 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;
+ if (ns->proc_name != NULL)
+ c->where = ns->proc_name->declared_at;
+ else
+ c->where = ns->blank_common.head->common_head->where;
+
strcpy (c->name, BLANK_COMMON_NAME);
translate_common (c, ns->blank_common.head);
}
-
+
/* Translate all named common blocks. */
gfc_traverse_symtree (ns->common_root, named_common);