From b4f45d022de923c12fe88cd2726ed95b63990d38 Mon Sep 17 00:00:00 2001 From: tobi Date: Sun, 29 Aug 2004 16:58:39 +0000 Subject: fortran/ PR fortran/13910 * decl.c (free_variable, free_value, gfc_free_data, var_list, var_element, top_var_list, match_data_constant, top_val_list, gfc_match_data): Move here from match.c. (match_old_style_init): New function. (variable_decl): Match old-style initialization. * expr.c (gfc_get_variable_expr): New function. * gfortran.h (gfc_get_variable_expr): Add prototype. * gfortran.texi: Start documentation for supported extensions. * match.c: Remove the functions moved to decl.c. * match.h (gfc_match_data): Move prototype to under decl.c. * symbol.c (gfc_find_sym_tree, gfc_find_symbol): Add/correct comments. testsuite/ PR fortran/13910 * gfortran.dg/oldstyle_1.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86729 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/expr.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'gcc/fortran/expr.c') diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index f9811857d7e..ab830645074 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1983,3 +1983,30 @@ gfc_default_initializer (gfc_typespec *ts) } return init; } + + +/* Given a symbol, create an expression node with that symbol as a + variable. If the symbol is array valued, setup a reference of the + whole array. */ + +gfc_expr * +gfc_get_variable_expr (gfc_symtree * var) +{ + gfc_expr *e; + + e = gfc_get_expr (); + e->expr_type = EXPR_VARIABLE; + e->symtree = var; + e->ts = var->n.sym->ts; + + if (var->n.sym->as != NULL) + { + e->rank = var->n.sym->as->rank; + e->ref = gfc_get_ref (); + e->ref->type = REF_ARRAY; + e->ref->u.ar.type = AR_FULL; + } + + return e; +} + -- cgit v1.2.3