On Fri, 11 Mar 2011, Richard Guenther wrote: > Indeed. I tried to let the array case alone (because it's so > complicated) but failed to do so. Appearantly > > if (declarator->kind == cdk_array && TYPE_QUALS (element_type)) > type = TYPE_MAIN_VARIANT (type); > > leaves it alone (and doesn't emit a DW_TAG_typedef for T for your > testcase). Thus out of the set of testcases I added the array > case now fails with the above (as I'd have expected but were of > course positively surprised as it didn't ...). > > I verified the main variants and canonical types are sane with > the above variant for your testcase. > > If you think such change isn't safe either I'll pursue a dwarf2out.c > local change, somehow forcing out the typedef DIE even if it is unused. > I don't feel at home in the grokdeclarator dungeon.
What I think is safe in grokdeclarator is using TYPE_MAIN_VARIANT here if *either* the type given in the declaration specifiers is an array type (TREE_CODE (type) == ARRAY_TYPE, as in your previous patch) *or* the first declarator that is not cdk_attrs is cdk_array (as in this version, but checking through a chain of declarator->declarator to find a possible cdk_array after a sequence of cdk_attrs). (Aside from all this it is a longstanding known bug that the debug information for arrays of qualified types isn't quite right: PR 8354.) -- Joseph S. Myers [email protected]
