aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog14
-rw-r--r--gcc/fortran/decl.c10
-rw-r--r--gcc/fortran/gfortran.h2
-rw-r--r--gcc/fortran/symbol.c6
4 files changed, 26 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 12c848a..9263d8a 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,17 @@
+2005-01-23 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/25901
+ * decl.c (get_proc_name): Replace subroutine and function attributes
+ in "already defined" test by the formal arglist pointer being non-NULL.
+
+ Fix regression in testing of admissability of attributes.
+ * symbol.c (gfc_add_attribute): If the current_attr has non-zero
+ intent, do not do the check for a dummy being used.
+ * decl.c (attr_decl1): Add current_attr.intent as the third argument
+ in the call to gfc_add_attribute.
+ * gfortran.h: Add the third argument to the prototype for
+ gfc_add_attribute.
+
2006-01-21 Joseph S. Myers <joseph@codesourcery.com>
* gfortranspec.c (lang_specific_driver): Update copyright notice
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 282ca73..7a80f81 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -611,10 +611,14 @@ get_proc_name (const char *name, gfc_symbol ** result)
if (sym && !sym->new && gfc_current_state () != COMP_INTERFACE)
{
- /* Trap another encompassed procedure with the same name. */
+ /* Trap another encompassed procedure with the same name. All
+ these conditions are necessary to avoid picking up an entry
+ whose name clashes with that of the encompassing procedure;
+ this is handled using gsymbols to register unique,globally
+ accessible names. */
if (sym->attr.flavor != 0
&& sym->attr.proc != 0
- && (sym->attr.subroutine || sym->attr.function))
+ && sym->formal)
gfc_error_now ("Procedure '%s' at %C is already defined at %L",
name, &sym->declared_at);
@@ -3202,7 +3206,7 @@ attr_decl1 (void)
goto cleanup;
}
- if (gfc_add_attribute (&sym->attr, &var_locus) == FAILURE)
+ if (gfc_add_attribute (&sym->attr, &var_locus, current_attr.intent) == FAILURE)
{
m = MATCH_ERROR;
goto cleanup;
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 9e5d303..a26eab0 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1701,7 +1701,7 @@ void gfc_get_component_attr (symbol_attribute *, gfc_component *);
void gfc_set_sym_referenced (gfc_symbol * sym);
-try gfc_add_attribute (symbol_attribute *, locus *);
+try gfc_add_attribute (symbol_attribute *, locus *, uint);
try gfc_add_allocatable (symbol_attribute *, locus *);
try gfc_add_dimension (symbol_attribute *, const char *, locus *);
try gfc_add_external (symbol_attribute *, locus *);
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index c4d2cf0..9a28df6 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -592,12 +592,14 @@ duplicate_attr (const char *attr, locus * where)
gfc_error ("Duplicate %s attribute specified at %L", attr, where);
}
+/* Called from decl.c (attr_decl1) to check attributes, when declared separately. */
try
-gfc_add_attribute (symbol_attribute * attr, locus * where)
+gfc_add_attribute (symbol_attribute * attr, locus * where, uint attr_intent)
{
- if (check_used (attr, NULL, where) || check_done (attr, where))
+ if (check_used (attr, NULL, where)
+ || (attr_intent == 0 && check_done (attr, where)))
return FAILURE;
return check_conflict (attr, NULL, where);