From b7263e8f2f6085de756c1f9ce479e94d731d972c Mon Sep 17 00:00:00 2001 From: Erik Edelmann Date: Sat, 18 Jun 2005 18:16:22 +0000 Subject: [PATCH] re PR fortran/19926 ([4.0 only] Incorrect rank with PARAMETER and array element.) PR fortran/19926 * primary.c (gfc_match_rvalue): expr_type can be EXPR_CONSTANT for an array; check that sym->as is NULL. Co-Authored-By: Steven G. Kargl From-SVN: r101161 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/primary.c | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0b3d11755f4..1d180a27f1f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2005-06-18 Erik Edelman + Steven G. Kargl + + PR fortran/19926 + * primary.c (gfc_match_rvalue): expr_type can be EXPR_CONSTANT + for an array; check that sym->as is NULL. + + 2005-06-18 Steven G. Kargl * intrinsic.c (gfc_intrinsic_func_interface): Enable errors for generic diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 38f9939201f..e1acfbf3621 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -1802,8 +1802,11 @@ gfc_match_rvalue (gfc_expr ** result) break; case FL_PARAMETER: - if (sym->value - && sym->value->expr_type != EXPR_ARRAY) + /* A statement of the form "REAL, parameter :: a(0:10) = 1" will + end up here. Unfortunately, sym->value->expr_type is set to + EXPR_CONSTANT, and so the if () branch would be followed without + the !sym->as check. */ + if (sym->value && sym->value->expr_type != EXPR_ARRAY && !sym->as) e = gfc_copy_expr (sym->value); else { -- 2.30.2