From ea13b9b7b59a9df6daf09a199be68e6947aa5a41 Mon Sep 17 00:00:00 2001 From: pault Date: Mon, 17 Oct 2005 20:52:37 +0000 Subject: 2005-10-17 Paul Thomas PR fortran/23446 * gfortran.h: Primitive for gfc_is_formal_arg. * resolve.c(gfc_is_formal_arg): New function to signal across several function calls that formal argument lists are being processed. (resolve_formal_arglist): Set/reset the flag for gfc_is_formal_arg. *expr.c(check_restricted): Add check, via gfc_is_formal_arg, if symbol is part of an formal argument declaration. PR fortran/21459 * decl.c (add_init_expr_to_sym): Make a new character length for each variable, when the expression is NULL and link to cl_list. PR fortran/20866 * match.c (recursive_stmt_fcn): New function that tests if a statement function resurses through itself or other other statement functions. (gfc_match_st_function): Call recursive_stmt_fcn to check if this is recursive and to raise error if so. PR fortran/20849 PR fortran/20853 * resolve.c (resolve_symbol): Errors for assumed size arrays with default initializer and for external objects with an initializer. PR fortran/20837 * decl.c (match_attr_spec): Prevent PUBLIC from being used outside a module. 2005-10-17 Paul Thomas PR fortran/23446 * gfortran.dg/host_dummy_index_1.f90: New test. PR fortran/21459 gfortran.dg/automatic_char_len_2.f90: New test. PR fortran/20866 gfortran.dg/recursive_statement_functions.f90: New test. PR fortran/20853 gfortran.dg/assumed_size_dt_dummy.f90: New test. PR fortran/20849 gfortran.dg/external_initializer.f90: New test. PR fortran/20837 non_module_public.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105518 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/decl.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gcc/fortran/decl.c') diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 20d1f8a2d20..21f1089e42d 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -746,6 +746,13 @@ add_init_expr_to_sym (const char *name, gfc_expr ** initp, /* Update symbol character length according initializer. */ if (sym->ts.cl->length == NULL) { + /* If there are multiple CHARACTER variables declared on + the same line, we don't want them to share the same + length. */ + sym->ts.cl = gfc_get_charlen (); + sym->ts.cl->next = gfc_current_ns->cl_list; + gfc_current_ns->cl_list = sym->ts.cl; + if (init->expr_type == EXPR_CONSTANT) sym->ts.cl->length = gfc_int_expr (init->value.character.length); @@ -1867,6 +1874,20 @@ match_attr_spec (void) goto cleanup; } + if ((d == DECL_PRIVATE || d == DECL_PUBLIC) + && gfc_current_state () != COMP_MODULE) + { + if (d == DECL_PRIVATE) + attr = "PRIVATE"; + else + attr = "PUBLIC"; + + gfc_error ("%s attribute at %L is not allowed outside of a MODULE", + attr, &seen_at[d]); + m = MATCH_ERROR; + goto cleanup; + } + switch (d) { case DECL_ALLOCATABLE: -- cgit v1.2.3