Commit ae976c33 by Janne Blomqvist

PR 83975 Associate target with non-constant character length

When associating a variable of type character, if the length of the
target isn't known at compile time, generate an error. See PR 83344
for more details.

Regtested on x86_64-pc-linux-gnu.

gcc/fortran/ChangeLog:

2018-02-01  Janne Blomqvist  <jb@gcc.gnu.org>

	PR 83975
	PR 83344
	* resolve.c (resolve_assoc_var): Generate an error if
	target length unknown.

From-SVN: r257310
parent bfa28724
2018-02-01 Janne Blomqvist <jb@gcc.gnu.org>
PR 83975
PR 83344
* resolve.c (resolve_assoc_var): Generate an error if
target length unknown.
2018-02-01 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/83705
* simplify.c (gfc_simplify_repeat): Increase limit for deferring
to runtime, print a warning message.
......
......@@ -8634,11 +8634,16 @@ resolve_assoc_var (gfc_symbol* sym, bool resolve_target)
if (!sym->ts.u.cl)
sym->ts.u.cl = target->ts.u.cl;
if (!sym->ts.u.cl->length && !sym->ts.deferred
&& target->expr_type == EXPR_CONSTANT)
sym->ts.u.cl->length
= gfc_get_int_expr (gfc_charlen_int_kind,
NULL, target->value.character.length);
if (!sym->ts.u.cl->length && !sym->ts.deferred)
{
if (target->expr_type == EXPR_CONSTANT)
sym->ts.u.cl->length =
gfc_get_int_expr (gfc_charlen_int_kind, NULL,
target->value.character.length);
else
gfc_error ("Not Implemented: Associate target with type character"
" and non-constant length at %L", &target->where);
}
}
/* If the target is a good class object, so is the associate variable. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment