Hi! This PR is about debug info containing the artificial "sizetype" type as name of a DW_TAG_base_type, which can clash with user sizetype identifiers etc.
Apparently we already have code that attempts to not expose that type, but only do that if sizetype has TYPE_DECL as TYPE_NAME and that denotes some other, standard, type. The following patch extends it to attempt to emit size_type_node name instead of "sizetype" if both sizetype and size_type_node have the same precision and signedness. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2017-04-01 Jakub Jelinek <ja...@redhat.com> PR debug/80263 * dwarf2out.c (modified_type_die): Try harder not to emit internal sizetype type into debug info. * gcc.dg/debug/dwarf2/pr80263.c: New test. --- gcc/dwarf2out.c.jj 2017-03-31 20:39:54.000000000 +0200 +++ gcc/dwarf2out.c 2017-04-01 11:24:50.319288819 +0200 @@ -12464,20 +12464,29 @@ modified_type_die (tree type, int cv_qua this type. */ qualified_type = get_qualified_type (type, cv_quals); - if (qualified_type == sizetype - && TYPE_NAME (qualified_type) - && TREE_CODE (TYPE_NAME (qualified_type)) == TYPE_DECL) + if (qualified_type == sizetype) { - tree t = TREE_TYPE (TYPE_NAME (qualified_type)); + /* Try not to expose the internal sizetype type's name. */ + if (TYPE_NAME (qualified_type) + && TREE_CODE (TYPE_NAME (qualified_type)) == TYPE_DECL) + { + tree t = TREE_TYPE (TYPE_NAME (qualified_type)); - gcc_checking_assert (TREE_CODE (t) == INTEGER_TYPE - && TYPE_PRECISION (t) - == TYPE_PRECISION (qualified_type) - && TYPE_UNSIGNED (t) - == TYPE_UNSIGNED (qualified_type)); - qualified_type = t; + gcc_checking_assert (TREE_CODE (t) == INTEGER_TYPE + && (TYPE_PRECISION (t) + == TYPE_PRECISION (qualified_type)) + && (TYPE_UNSIGNED (t) + == TYPE_UNSIGNED (qualified_type))); + qualified_type = t; + } + else if (qualified_type == sizetype + && TREE_CODE (sizetype) == TREE_CODE (size_type_node) + && TYPE_PRECISION (sizetype) == TYPE_PRECISION (size_type_node) + && TYPE_UNSIGNED (sizetype) == TYPE_UNSIGNED (size_type_node)) + qualified_type = size_type_node; } + /* If we do, then we can just use its DIE, if it exists. */ if (qualified_type) { --- gcc/testsuite/gcc.dg/debug/dwarf2/pr80263.c.jj 2017-04-01 11:29:32.648668616 +0200 +++ gcc/testsuite/gcc.dg/debug/dwarf2/pr80263.c 2017-04-01 11:31:42.954996922 +0200 @@ -0,0 +1,7 @@ +/* PR debug/80263 */ +/* { dg-do compile } */ +/* { dg-options "-g -dA" } */ + +char array[1]; + +/* { dg-final { scan-assembler-not {\msizetype} } } */ Jakub