diff options
author | Mikael Morin <mikael@gcc.gnu.org> | 2012-01-04 14:04:24 +0000 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2012-01-04 14:04:24 +0000 |
commit | 0192ef204cbc1b80a1da59dae7b275cb7de67c81 (patch) | |
tree | 35ecccc993dae3c75c7845b088145f81382da192 /gcc/fortran/trans-expr.c | |
parent | 591823cc9aba6f6943f7204df365bf2f0ca593ca (diff) | |
download | gcc-0192ef204cbc1b80a1da59dae7b275cb7de67c81.zip gcc-0192ef204cbc1b80a1da59dae7b275cb7de67c81.tar.gz gcc-0192ef204cbc1b80a1da59dae7b275cb7de67c81.tar.bz2 |
re PR fortran/50981 ([OOP] Wrong-code for scalarizing ELEMENTAL call with absent OPTIONAL argument)
PR fortran/50981
* trans.h (struct gfc_ss_info): New field data::scalar::can_be_null_ref
* trans-array.c: If the reference can be NULL, save the reference
instead of the value.
* trans-expr.c (gfc_conv_expr): If we have saved a reference,
dereference it.
From-SVN: r182874
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 12d382d..54572fb 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -5331,6 +5331,11 @@ gfc_conv_expr (gfc_se * se, gfc_expr * expr) /* Substitute a scalar expression evaluated outside the scalarization loop. */ se->expr = ss_info->data.scalar.value; + /* If the reference can be NULL, the value field contains the reference, + not the value the reference points to (see gfc_add_loop_ss_code). */ + if (ss_info->data.scalar.can_be_null_ref) + se->expr = build_fold_indirect_ref_loc (input_location, se->expr); + se->string_length = ss_info->string_length; gfc_advance_se_ss_chain (se); return; |