diff options
Diffstat (limited to 'gcc/fortran')
| -rw-r--r-- | gcc/fortran/ChangeLog | 10 | ||||
| -rw-r--r-- | gcc/fortran/match.c | 7 | ||||
| -rw-r--r-- | gcc/fortran/trans-common.c | 11 |
3 files changed, 23 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 84804f9..e9ba75f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +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. + 2006-10-31 Francois-Xavier Coudert <coudert@clipper.ens.fr> PR fortran/29067 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 3f393856..5012c35 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -2327,16 +2327,19 @@ gfc_match_common (void) if (name[0] == '\0') { + if (gfc_current_ns->is_block_data) + { + gfc_warning ("BLOCK DATA unit cannot contain blank COMMON at %C"); + } t = &gfc_current_ns->blank_common; if (t->head == NULL) t->where = gfc_current_locus; - head = &t->head; } else { t = gfc_get_common (name, 0); - head = &t->head; } + head = &t->head; if (*head == NULL) tail = NULL; 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); |
