https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106945
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org --- Comment #5 from anlauf at gcc dot gnu.org --- The issue appears to be a missing conversion: diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 045c8b00b90..dcd39f46776 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -1531,6 +1531,7 @@ gfc_copy_class_to_class (tree from, tree to, tree nelems, bool unlimited) name = (const char *)(DECL_NAME (to)->identifier.id.str); from_len = gfc_conv_descriptor_size (from_data, 1); + from_len = fold_convert (TREE_TYPE (orig_nelems), from_len); tmp = fold_build2_loc (input_location, NE_EXPR, logical_type_node, from_len, orig_nelems); msg = xasprintf ("Array bound mismatch for dimension %d " While orig_nelems may come in as size_type_node (i.e. unsigned) from two callsites, gfc_conv_descriptor_size returns gfc_array_index_type (signed). As the actual size cannot be negative, it should be safe to convert it to the type of orig_nelems.