Commit 81e87db4 by Steven G. Kargl

re PR fortran/91566 (ICE in gfc_constructor_copy, at fortran/constructor.c:103)

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  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/91566
	* gfortran.dg/pr91566.f90:

From-SVN: r275704
parent c28712be
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
......
......@@ -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))
......
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
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment