On Sat, 25 Jan 2025, Jakub Jelinek wrote:

> The following patch uses build_qualified_type with TYPE_UNQUALIFIED instead,
> which will be in the common case the same as TYPE_MAIN_VARIANT if the
> checks are satisfied for it, but if not, will look up different unqualified
> type or even create it if there is none.

Using build_qualified_type would I think also have the effect of not 
removing the qualifiers from the element type of an array type.  The 
design followed in grokdeclarator is given by the comment:

     At each stage we maintain an unqualified version of the type
     together with any qualifiers that should be applied to it with
     c_build_qualified_type; this way, array types including
     multidimensional array types are first built up in unqualified
     form and then the qualified form is created with
     TYPE_MAIN_VARIANT pointing to the unqualified form.  */

The patch is OK with c_build_qualified_type used instead of 
build_qualified_type, if that works.

-- 
Joseph S. Myers
josmy...@redhat.com

Reply via email to