------- Comment #14 from rguenth at gcc dot gnu dot org 2010-02-14 10:40 ------- Err, you can't simply adjust a types main variant like
t = build_cplus_array_type_1 (element_type, TYPE_DOMAIN (type)); if (TYPE_MAIN_VARIANT (t) != TYPE_MAIN_VARIANT (type)) { /* Set the main variant of the newly-created ARRAY_TYPE (with cv-qualified element type) to the main variant of the unqualified ARRAY_TYPE we started with. */ as types are shared and build_cplus_array_type_1 can return an already existing type. I suppose the hashing machinery isn't working well with multidimensional array types. A way out is to build a distinct type copy here in the TYPE_MAIN_VARIANT (t) != TYPE_MAIN_VARIANT (type) case. Though you have to watch out for proper TYPE_CANONICAL. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43036