+2012-05-23 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51055
+ PR fortran/45170
+ * match.c (gfc_match_allocate): Set length_from_typespec
+ for characters.
+ * resolve.c (resolve_charlen): If set, don't check whether
+ the len is a specification expression.
+
2012-05-22 Tobias Burnus <burnus@net-b.de>
PR fortran/53389
"type parameter", &old_locus);
goto cleanup;
}
+
+ if (ts.type == BT_CHARACTER)
+ ts.u.cl->length_from_typespec = true;
}
else
{
cl->resolved = 1;
- specification_expr = 1;
- if (resolve_index_expr (cl->length) == FAILURE)
+ if (cl->length_from_typespec)
{
- specification_expr = 0;
- return FAILURE;
+ if (gfc_resolve_expr (cl->length) == FAILURE)
+ return FAILURE;
+
+ if (gfc_simplify_expr (cl->length, 0) == FAILURE)
+ return FAILURE;
+ }
+ else
+ {
+ specification_expr = 1;
+
+ if (resolve_index_expr (cl->length) == FAILURE)
+ {
+ specification_expr = 0;
+ return FAILURE;
+ }
}
/* "If the character length parameter value evaluates to a negative
+2012-05-23 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51055
+ PR fortran/45170
+ * gfortran.dg/allocate_with_typespec_6.f90: New.
+
2012-05-23 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/29185
--- /dev/null
+! { dg-do compile }
+!
+! PR fortran/51055
+! PR fortran/45170 comment 14
+!
+! Contributed by Juha Ruokolainen
+! and Hans-Werner Boschmann
+!
+! gfortran was before checking whether the length
+! was a specification expression.
+!
+
+program a
+ character(len=:), allocatable :: s
+ integer :: i=10
+ allocate(character(len=i)::s)
+end program a