https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103413
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org --- Comment #9 from anlauf at gcc dot gnu.org --- Steve, what do you think about the following patch? Not yet fully regtested. It should fix the issue much simpler by checking type compatibility: diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc index 6050359d521..f4052eb7042 100644 --- a/gcc/fortran/symbol.cc +++ b/gcc/fortran/symbol.cc @@ -5139,6 +5141,9 @@ gfc_type_compatible (gfc_typespec *ts1, gfc_typespec *ts2) bool is_union1 = (ts1->type == BT_UNION); bool is_union2 = (ts2->type == BT_UNION); + if (ts2->type == BT_BOZ) + return (ts1->type == BT_INTEGER || ts1->type == BT_REAL); + if (is_class1 && ts1->u.derived->components && ((ts1->u.derived->attr.is_class Do you have a testcase that exercises BT_INTEGER and BT_REAL here? I thought that one of the pathes that reaches gfc_boz2int and gfc_boz2real might need the above.