The below adds additional verification to fld_type_variant that
there's only one variant matching fld_type_variant_equal_p on the
chain. The PR shows that variants built with build_qualified_type
can be equal to others in that regard but not with regard to
what build_qualified_type does.
PR lto/113207
* ipa-free-lang-data.cc (fld_type_variant): Add extra checking.
return t;
for (tree v = first; v; v = TYPE_NEXT_VARIANT (v))
if (fld_type_variant_equal_p (t, v, inner_type))
- return v;
+ {
+ if (flag_checking)
+ for (tree v2 = TYPE_NEXT_VARIANT (v); v2; v2 = TYPE_NEXT_VARIANT (v2))
+ gcc_assert (!fld_type_variant_equal_p (t, v2, inner_type));
+ return v;
+ }
tree v = build_variant_type_copy (first);
TYPE_READONLY (v) = TYPE_READONLY (t);
TYPE_VOLATILE (v) = TYPE_VOLATILE (t);