aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2008-01-30 06:56:10 +0000
committerPaul Thomas <pault@gcc.gnu.org>2008-01-30 06:56:10 +0000
commita99d95a270cabbbf43024c32ac6225da13e4aad1 (patch)
tree0114132c0dd451283cabb7a4b589fc60b10dae25 /gcc/fortran/decl.c
parent7ae252ab69e5498454d5ef1592eabd503353d17e (diff)
downloadgcc-a99d95a270cabbbf43024c32ac6225da13e4aad1.zip
gcc-a99d95a270cabbbf43024c32ac6225da13e4aad1.tar.gz
gcc-a99d95a270cabbbf43024c32ac6225da13e4aad1.tar.bz2
re PR fortran/34975 (Bogus error with USEing modules)
2008-01-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/34975 * symbol.c (gfc_delete_symtree, gfc_undo_symbols): Rename delete_symtree to gfc_delete_symtree. * gfortran.h : Add prototype for gfc_delete_symtree. * module.c (load_generic_interfaces): Transfer symbol to a unique symtree and delete old symtree, instead of renaming. (read_module): The rsym and the found symbol are the same, so the found symtree can be deleted. PR fortran/34429 * decl.c (match_char_spec): Remove the constraint on deferred matching of functions and free the length expression. delete_symtree to gfc_delete_symtree. (gfc_match_type_spec): Whitespace. (gfc_match_function_decl): Defer characteristic association for all types except BT_UNKNOWN. * parse.c (decode_specification_statement): Only derived type function matching is delayed to the end of specification. 2008-01-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/34975 * gfortran.dg/use_only_3.f90: New test. * gfortran.dg/use_only_3.inc: Modules for new test. PR fortran/34429 * gfortran.dg/function_charlen_2.f90: New test. From-SVN: r131956
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 115b30e..06c1df3 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2151,13 +2151,10 @@ syntax:
return m;
done:
- /* Except in the case of the length being a function, where symbol
- association looks after itself, deal with character functions
- after the specification statements. */
- if (gfc_matching_function
- && !(len && len->expr_type != EXPR_VARIABLE
- && len->expr_type != EXPR_OP))
+ /* Deal with character functions after USE and IMPORT statements. */
+ if (gfc_matching_function)
{
+ gfc_free_expr (len);
gfc_undo_symbols ();
return MATCH_YES;
}
@@ -2222,8 +2219,8 @@ gfc_match_type_spec (gfc_typespec *ts, int implicit_flag)
/* A belt and braces check that the typespec is correctly being treated
as a deferred characteristic association. */
seen_deferred_kind = (gfc_current_state () == COMP_FUNCTION)
- && (gfc_current_block ()->result->ts.kind == -1)
- && (ts->kind == -1);
+ && (gfc_current_block ()->result->ts.kind == -1)
+ && (ts->kind == -1);
gfc_clear_ts (ts);
if (seen_deferred_kind)
ts->kind = -1;
@@ -4358,21 +4355,13 @@ gfc_match_function_decl (void)
goto cleanup;
}
- /* Except in the case of a function valued character length,
- delay matching the function characteristics until after the
+ /* Delay matching the function characteristics until after the
specification block by signalling kind=-1. */
- if (!(current_ts.type == BT_CHARACTER
- && current_ts.cl
- && current_ts.cl->length
- && current_ts.cl->length->expr_type != EXPR_OP
- && current_ts.cl->length->expr_type != EXPR_VARIABLE))
- {
- sym->declared_at = old_loc;
- if (current_ts.type != BT_UNKNOWN)
- current_ts.kind = -1;
- else
- current_ts.kind = 0;
- }
+ sym->declared_at = old_loc;
+ if (current_ts.type != BT_UNKNOWN)
+ current_ts.kind = -1;
+ else
+ current_ts.kind = 0;
if (result == NULL)
{