As confirmed in the PR by Jakub, there was a bad conversion of the result of min0/max0 to the result type. We should just unconditionally convert in all cases. As a benefit, this also fixes pr100283. Committed after regtesting. Thanks, Harald Fortran - fix conversion to result type for the min/max intrinsic gcc/fortran/ChangeLog: PR fortran/100283 PR fortran/101123 * trans-intrinsic.c (gfc_conv_intrinsic_minmax): Unconditionally convert result of min/max to result type. gcc/testsuite/ChangeLog: PR fortran/100283 PR fortran/101123 * gfortran.dg/min0_max0_1.f90: New test. * gfortran.dg/min0_max0_2.f90: New test.