https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107874
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Harald Anlauf <anl...@gcc.gnu.org>: https://gcc.gnu.org/g:3832c6f7e672e76bba74a508bf3a49740ea38046 commit r13-4394-g3832c6f7e672e76bba74a508bf3a49740ea38046 Author: Harald Anlauf <anl...@gmx.de> Date: Mon Nov 28 20:43:02 2022 +0100 Fortran: intrinsic MERGE shall use all its arguments [PR107874] gcc/fortran/ChangeLog: PR fortran/107874 * simplify.cc (gfc_simplify_merge): When simplifying MERGE with a constant scalar MASK, ensure that arguments TSOURCE and FSOURCE are either constant or will be evaluated. * trans-intrinsic.cc (gfc_conv_intrinsic_merge): Evaluate arguments before generating conditional expression. gcc/testsuite/ChangeLog: PR fortran/107874 * gfortran.dg/merge_init_expr_2.f90: Adjust code to the corrected simplification. * gfortran.dg/merge_1.f90: New test. Co-authored-by: Steven G. Kargl <ka...@gcc.gnu.org>