diff options
author | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-05 16:10:19 +0000 |
---|---|---|
committer | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-05 16:10:19 +0000 |
commit | 9508273b7413e558c002dbc62c1e6d361c063975 (patch) | |
tree | c665e2426f5c2db1de2f984e9fe9682991a6da62 /gcc/fortran/iresolve.c | |
parent | c0bd8167f27fe06ed92d9d540cfdade4374ef0bc (diff) | |
download | gcc-9508273b7413e558c002dbc62c1e6d361c063975.tar.gz |
2009-08-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40847
* iresolve.c (gfc_resolve_transfer): Correct error in 'mold'
character length for case where length expresson is NULL.
2009-08-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40847
* gfortran.dg/transfer_resolve_1.f90 : New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150493 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/iresolve.c')
-rw-r--r-- | gcc/fortran/iresolve.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index fdbf40c4408..5bb24a42a21 100644 --- a/gcc/fortran/iresolve.c +++ b/gcc/fortran/iresolve.c @@ -2340,9 +2340,19 @@ gfc_resolve_transfer (gfc_expr *f, gfc_expr *source ATTRIBUTE_UNUSED, /* TODO: Make this do something meaningful. */ static char transfer0[] = "__transfer0", transfer1[] = "__transfer1"; - if (mold->ts.type == BT_CHARACTER && !mold->ts.cl->length - && !(mold->expr_type == EXPR_VARIABLE && mold->symtree->n.sym->attr.dummy)) - mold->ts.cl->length = gfc_int_expr (mold->value.character.length); + if (mold->ts.type == BT_CHARACTER + && !mold->ts.cl->length + && gfc_is_constant_expr (mold)) + { + int len; + if (mold->expr_type == EXPR_CONSTANT) + mold->ts.cl->length = gfc_int_expr (mold->value.character.length); + else + { + len = mold->value.constructor->expr->value.character.length; + mold->ts.cl->length = gfc_int_expr (len); + } + } f->ts = mold->ts; |