From: Richard Guenther Date: Mon, 21 Mar 2011 15:32:21 +0000 (+0000) Subject: re PR c/47939 (Missing DW_TAG_typedef for qualified types) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=411cdbd841d21a48ebc7f89f6d62c60f3e0dad47;p=gcc.git re PR c/47939 (Missing DW_TAG_typedef for qualified types) 2011-03-21 Richard Guenther PR c/47939 * c-decl.c (grokdeclarator): Drop to the main variant only for array types. Drop flag_gen_aux_info check. * gcc.dg/debug/dwarf2/pr47939-1.c: New testcase. * gcc.dg/debug/dwarf2/pr47939-2.c: Likewise. * gcc.dg/debug/dwarf2/pr47939-3.c: Likewise. * gcc.dg/debug/dwarf2/pr47939-4.c: Likewise. From-SVN: r171245 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 55e6e952b26..30542ef287a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-03-21 Richard Guenther + + PR c/47939 + * c-decl.c (grokdeclarator): Drop to the main variant only + for array types. Drop flag_gen_aux_info check. + 2011-03-21 Richard Guenther PR translation/47911 diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 4e82f2844a8..1af3d23b677 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4888,6 +4888,7 @@ grokdeclarator (const struct c_declarator *declarator, const char *errmsg; tree expr_dummy; bool expr_const_operands_dummy; + enum c_declarator_kind first_non_attr_kind; if (TREE_CODE (type) == ERROR_MARK) return error_mark_node; @@ -4907,6 +4908,7 @@ grokdeclarator (const struct c_declarator *declarator, { const struct c_declarator *decl = declarator; + first_non_attr_kind = cdk_attrs; while (decl) switch (decl->kind) { @@ -4918,6 +4920,8 @@ grokdeclarator (const struct c_declarator *declarator, case cdk_pointer: funcdef_syntax = (decl->kind == cdk_function); decl = decl->declarator; + if (first_non_attr_kind == cdk_attrs) + first_non_attr_kind = decl->kind; break; case cdk_attrs: @@ -4928,6 +4932,8 @@ grokdeclarator (const struct c_declarator *declarator, loc = decl->id_loc; if (decl->u.id) name = decl->u.id; + if (first_non_attr_kind == cdk_attrs) + first_non_attr_kind = decl->kind; decl = 0; break; @@ -5034,7 +5040,9 @@ grokdeclarator (const struct c_declarator *declarator, error_at (loc, "conflicting named address spaces (%s vs %s)", c_addr_space_name (as1), c_addr_space_name (as2)); - if (!flag_gen_aux_info && (TYPE_QUALS (element_type))) + if ((TREE_CODE (type) == ARRAY_TYPE + || first_non_attr_kind == cdk_array) + && TYPE_QUALS (element_type)) type = TYPE_MAIN_VARIANT (type); type_quals = ((constp ? TYPE_QUAL_CONST : 0) | (restrictp ? TYPE_QUAL_RESTRICT : 0) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 570ab6f7d8d..8bce5264b36 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2011-03-21 Richard Guenther + + PR c/47939 + * gcc.dg/debug/dwarf2/pr47939-1.c: New testcase. + * gcc.dg/debug/dwarf2/pr47939-2.c: Likewise. + * gcc.dg/debug/dwarf2/pr47939-3.c: Likewise. + * gcc.dg/debug/dwarf2/pr47939-4.c: Likewise. + 2011-03-21 Jakub Jelinek PR target/48213 diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-1.c new file mode 100644 index 00000000000..7854fdf73bb --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-save-temps -g -dA" } */ + +typedef struct _Harry { int dummy; } Harry_t; +Harry_t harry; + +/* { dg-final { scan-assembler "DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_name: \"Harry_t\"" } } */ +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-2.c new file mode 100644 index 00000000000..8b623aef9ff --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-2.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-save-temps -g -dA" } */ + +typedef const struct _Harry { int dummy; } Harry_t; +Harry_t harry; + +/* { dg-final { scan-assembler "DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_name: \"Harry_t\"" } } */ +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-3.c new file mode 100644 index 00000000000..374e6cc9077 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-3.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-save-temps -g -dA" } */ + +typedef struct _Harry { int dummy; } Harry_t; +const Harry_t harry[5]; + +/* { dg-final { scan-assembler "DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_name: \"Harry_t\"" } } */ +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-4.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-4.c new file mode 100644 index 00000000000..57db399595c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-4.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-save-temps -g -dA" } */ + +typedef const struct _Harry { int dummy; } Harry_t; +Harry_t harry[10]; + +/* { dg-final { scan-assembler "DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_name: \"Harry_t\"" } } */ +/* { dg-final { cleanup-saved-temps } } */