diff options
author | Janne Blomqvist <jb@gcc.gnu.org> | 2017-12-28 20:49:12 +0200 |
---|---|---|
committer | Janne Blomqvist <jb@gcc.gnu.org> | 2017-12-28 20:49:12 +0200 |
commit | 208413c7b4d3a2360ba4864f00ceaf720b4f67c7 (patch) | |
tree | 580b1b983ec82b840b86649b556573849f117aa4 /gcc/fortran/resolve.c | |
parent | 9fd8313a89d1c76b3f204b33c854e3cdc4b5a2d7 (diff) | |
download | gcc-208413c7b4d3a2360ba4864f00ceaf720b4f67c7.zip gcc-208413c7b4d3a2360ba4864f00ceaf720b4f67c7.tar.gz gcc-208413c7b4d3a2360ba4864f00ceaf720b4f67c7.tar.bz2 |
PR fortran/83344 Don't set bogus constant value
This patch does not fix PR 83344, but merely fixes an error where we
used to set a constant character length value from a non-constant
expression, and thus set it to some bogus value.
As a result of this, I have commented out part of the associate_22.f90
test which otherwise generates a warning message.
Regtested on x86_64-pc-linux-gnu.
gcc/fortran/ChangeLog:
2017-12-28 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/83344
* resolve.c (resolve_assoc_var): Don't set the constant value
unless the target is a constant expression.
gcc/testsuite/ChangeLog:
2017-12-28 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/83344
* gfortran.dg/associate_22.f90: Comment out part of test.
From-SVN: r256021
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index f819b71..cf75a78 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -8627,7 +8627,8 @@ 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) + if (!sym->ts.u.cl->length && !sym->ts.deferred + && target->expr_type == EXPR_CONSTANT) sym->ts.u.cl->length = gfc_get_int_expr (gfc_default_integer_kind, NULL, target->value.character.length); |