diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 630ffe04872..0d29f46d3c7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2006-10-24 Erik Edelmann + + PR fortran/29393 + * expr.c (simplify_parameter_variable): Keep rank of original + expression. + 2006-10-23 Rafael Avila de Espindola * Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 2bf980cfa25..1f51fd09fca 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1363,6 +1363,8 @@ simplify_parameter_variable (gfc_expr * p, int type) if (e == NULL) return FAILURE; + e->rank = p->rank; + /* Do not copy subobject refs for constant. */ if (e->expr_type != EXPR_CONSTANT && p->ref != NULL) e->ref = copy_ref (p->ref); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5ed77bf1391..87c2154f9e1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-10-24 Erik Edelmann + + PR fortran/29393 + * gfortran.dg/initialize_2.f90: New. + 2006-10-24 Kaveh R. Ghazi * gcc.dg/torture/builtin-math-2.c: New test. diff --git a/gcc/testsuite/gfortran.dg/initialization_2.f90 b/gcc/testsuite/gfortran.dg/initialization_2.f90 new file mode 100644 index 00000000000..d5de85941d1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/initialization_2.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +! PR 29393: Ranks of PARAMETER-lhs in initializations + integer, parameter :: A(-3:7,2)=0 + integer, parameter, dimension(3) :: V = (/ 2, 4, 6 /) + integer, parameter, dimension(3) :: B = A(V,1) + integer, parameter, dimension(3) :: C = A(0:2,1) +end