diff options
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r-- | gcc/fortran/simplify.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 023eedb..3d2fc0d 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -4780,8 +4780,13 @@ gfc_simplify_merge (gfc_expr *tsource, gfc_expr *fsource, gfc_expr *mask) gfc_constructor *tsource_ctor, *fsource_ctor, *mask_ctor; if (mask->expr_type == EXPR_CONSTANT) - return gfc_get_parentheses (gfc_copy_expr (mask->value.logical - ? tsource : fsource)); + { + result = gfc_copy_expr (mask->value.logical ? tsource : fsource); + /* Parenthesis is needed to get lower bounds of 1. */ + result = gfc_get_parentheses (result); + gfc_simplify_expr (result, 1); + return result; + } if (!mask->rank || !is_constant_array_expr (mask) || !is_constant_array_expr (tsource) || !is_constant_array_expr (fsource)) |