https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101123
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This is clearly a FE bug: gfc_conv_intrinsic_minmax does: if (TREE_CODE (type) == INTEGER_TYPE) se->expr = fold_build1_loc (input_location, FIX_TRUNC_EXPR, type, mvar); else se->expr = convert (type, mvar); and as type (in this kase integer(kind=8)) is INTEGER_TYPE, it creates a FIX_TRUNC_EXPR. But that is only valid if mvar has floating point type, which is not the case here. Why don't you do se->expr = convert (type, mvar); unconditionally? That should create FIX_TRUNC_EXPR for the FLOAT_TYPE -> INTEGER_TYPE conversion as well, but will handle correctly even INTEGER_TYPE -> INTEGER_TYPE conversions etc.?