Commit 411cdbd8 by Richard Guenther Committed by Richard Biener

re PR c/47939 (Missing DW_TAG_typedef for qualified types)

2011-03-21  Richard Guenther  <rguenther@suse.de>

	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
parent 1cd9e416
2011-03-21 Richard Guenther <rguenther@suse.de>
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 <rguenther@suse.de>
PR translation/47911
* params.def (lto-partitions): Fix typo.
(lto-min-partition): Fix wording.
......
......@@ -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)
......
2011-03-21 Richard Guenther <rguenther@suse.de>
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 <jakub@redhat.com>
PR target/48213
......
/* { 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 } } */
/* { 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 } } */
/* { 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 } } */
/* { 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 } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment