+2019-09-13 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/91566
+ * simplify.c (gfc_simplify_merge): Need to simplify expression
+ after insertation of parenthesis.
+
2019-09-13 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR fortran/91716
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))
+2019-09-13 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/91566
+ * gfortran.dg/pr91566.f90:
+
2019-09-13 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR fortran/91716
--- /dev/null
+! { dg-do compile }
+! Code contributed by Gerhard Steinmetz
+program p
+ call q
+ call r
+end program p
+
+subroutine q
+ print *, -merge([3,4], 0, [.false.,.true.])
+end
+
+subroutine r
+ print *, 2 + merge([3,4], 0, [.false.,.true.])
+end