On Sun, 1 Jun 2025, Martin Uecker wrote: > This patch now moves the checking assertion out of the recursion, > which seems better anyhow. I could not do the check unconditionally > for all types. because we sometimes call composite_type for with > mismatching qualifiers.
Calling composite_type with mismatching qualifiers seems like a bug; it's directly contrary to the comment on composite_type_internal. So either the code with the call is wrong, or that comment should give a proper description of the circumstances under which calling with mismatching qualifiers is OK. /* Return the composite type of two compatible types. We assume that comptypes has already been done and returned nonzero; if that isn't so, this may crash. In particular, we assume that qualifiers match. */ > @@ -1004,7 +999,15 @@ tree > composite_type (tree t1, tree t2) > { > struct composite_cache cache = { }; > - return composite_type_internal (t1, t2, &cache); > + tree n = composite_type_internal (t1, t2, &cache); > + /* For function and arrays there are some exceptions where > + qualifiers do not match. */ The patch is OK with this comment updated to reference an open bug in Bugzilla about the cases where composite_type is called with mismatching qualifiers. -- Joseph S. Myers josmy...@redhat.com