http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55501
--- Comment #7 from janus at gcc dot gnu.org 2012-11-28 10:50:28 UTC ---
I think the following variant makes even more sense:
Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c (revision 193810)
+++ gcc/fortran/simplify.c (working copy)
@@ -3973,9 +3973,7 @@ gfc_simplify_maskl (gfc_expr *i, gfc_expr *kind_ar
gfc_expr *
gfc_simplify_merge (gfc_expr *tsource, gfc_expr *fsource, gfc_expr *mask)
{
- if (tsource->expr_type != EXPR_CONSTANT
- || fsource->expr_type != EXPR_CONSTANT
- || mask->expr_type != EXPR_CONSTANT)
+ if (mask->expr_type != EXPR_CONSTANT)
return NULL;
return gfc_copy_expr (mask->value.logical ? tsource : fsource);
In order to simplify a MERGE expression, we don't need to rely on the TSOURCE
and FSOURCE arguments being constant. It's sufficient that the MASK is.