https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119792
--- Comment #14 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > FWIW, when I restore my patch on GCC-14 and add the size check to > useless_type_conversion_p, this then fixes the Ada test case. > > diff --git a/gcc/gimple-expr.cc b/gcc/gimple-expr.cc > index 0477c9d5f44..79ac3d35350 100644 > --- a/gcc/gimple-expr.cc > +++ b/gcc/gimple-expr.cc > @@ -283,7 +283,11 @@ useless_type_conversion_p (tree outer_type, tree > inner_type) > else if (AGGREGATE_TYPE_P (inner_type) > && TREE_CODE (inner_type) == TREE_CODE (outer_type)) > return TYPE_CANONICAL (inner_type) > - && TYPE_CANONICAL (inner_type) == TYPE_CANONICAL (outer_type); > + && TYPE_CANONICAL (inner_type) == TYPE_CANONICAL (outer_type) > + && TREE_CODE (TYPE_SIZE (inner_type)) == INTEGER_CST > + && TREE_CODE (TYPE_SIZE (outer_type)) == INTEGER_CST > + && tree_int_cst_equal (TYPE_SIZE (outer_type), > + TYPE_SIZE (inner_type)); But will very likely introduce other regressions, because a lot of types do not have a fixed size in Ada.