From f0a51891e3c659a5ee921520afda547843de2001 Mon Sep 17 00:00:00 2001 From: jvdelisle Date: Wed, 28 Nov 2007 01:02:36 +0000 Subject: [PATCH] 2007-11-27 Jerry DeLisle PR fortran/32928 * decl.c (match_data_constant): Use gfc_match_init_expr to match the array spec and set the initializer expression. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130484 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/decl.c | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fcb03bc..19eba46 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,11 @@ 2007-11-27 Jerry DeLisle + PR fortran/32928 + * decl.c (match_data_constant): Use gfc_match_init_expr to match the + array spec and set the initializer expression. + +2007-11-27 Jerry DeLisle + PR fortran/34227 * match.c (gfc_match_common): Add additional check for BLOCK DATA. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index a35071b..0da9cd2 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -370,6 +370,30 @@ match_data_constant (gfc_expr **result) else if (sym->attr.flavor == FL_DERIVED) return gfc_match_structure_constructor (sym, result); + /* Check to see if the value is an initialization array expression. */ + if (sym->value->expr_type == EXPR_ARRAY) + { + gfc_current_locus = old_loc; + + m = gfc_match_init_expr (result); + if (m == MATCH_ERROR) + return m; + + if (m == MATCH_YES) + { + if (gfc_simplify_expr (*result, 0) == FAILURE) + m = MATCH_ERROR; + + if ((*result)->expr_type == EXPR_CONSTANT) + return m; + else + { + gfc_error ("Invalid initializer %s in Data statement at %C", name); + return MATCH_ERROR; + } + } + } + *result = gfc_copy_expr (sym->value); return MATCH_YES; } -- 2.7.4