aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2007-11-21 18:32:40 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2007-11-21 18:32:40 +0000
commit0df50e7a0c54c2f5d607c25cfd7b97e5da222d0c (patch)
treeb686db35b0db0fd1df24395b4a72da636f5547ba /gcc/fortran/resolve.c
parentc60cd1dcf7a8c5d20ad41ba781d562ebc5dca45c (diff)
downloadgcc-0df50e7a0c54c2f5d607c25cfd7b97e5da222d0c.zip
gcc-0df50e7a0c54c2f5d607c25cfd7b97e5da222d0c.tar.gz
gcc-0df50e7a0c54c2f5d607c25cfd7b97e5da222d0c.tar.bz2
re PR fortran/34083 (internal compiler error: in gfc_conv_array_constructor_expr, at fortran/trans-expr.c:2819)
PR fortran/34083 * resolve.c (resolve_structure_cons): Also check for zero rank. * gfortran.dg/derived_constructor_comps_2.f90: Add check. From-SVN: r130332
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 6c9856d..c6808eb 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -742,6 +742,8 @@ resolve_structure_cons (gfc_expr *expr)
for (; comp; comp = comp->next, cons = cons->next)
{
+ int rank;
+
if (!cons->expr)
continue;
@@ -751,14 +753,14 @@ resolve_structure_cons (gfc_expr *expr)
continue;
}
- if (cons->expr->expr_type != EXPR_NULL
- && comp->as && comp->as->rank != cons->expr->rank
+ rank = comp->as ? comp->as->rank : 0;
+ if (cons->expr->expr_type != EXPR_NULL && rank != cons->expr->rank
&& (comp->allocatable || cons->expr->rank))
{
gfc_error ("The rank of the element in the derived type "
"constructor at %L does not match that of the "
"component (%d/%d)", &cons->expr->where,
- cons->expr->rank, comp->as ? comp->as->rank : 0);
+ cons->expr->rank, rank);
t = FAILURE;
}