File nvl675609.patch of Package gcc43

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.

Index: gcc/c-decl.c
===================================================================
*** gcc/c-decl.c.orig	2009-06-24 16:47:00.000000000 +0200
--- gcc/c-decl.c	2011-03-21 16:42:27.000000000 +0100
*************** grokdeclarator (const struct c_declarato
*** 3998,4003 ****
--- 3998,4004 ----
    bool bitfield = width != NULL;
    tree element_type;
    struct c_arg_info *arg_info = 0;
+   enum c_declarator_kind first_non_attr_kind;
  
    if (decl_context == FUNCDEF)
      funcdef_flag = true, decl_context = NORMAL;
*************** grokdeclarator (const struct c_declarato
*** 4008,4013 ****
--- 4009,4015 ----
      const struct c_declarator *decl = declarator;
      name = 0;
  
+     first_non_attr_kind = cdk_attrs;
      while (decl)
        switch (decl->kind)
  	{
*************** grokdeclarator (const struct c_declarato
*** 4016,4021 ****
--- 4018,4025 ----
  	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:
*************** grokdeclarator (const struct c_declarato
*** 4025,4030 ****
--- 4029,4036 ----
  	case cdk_id:
  	  if (decl->u.id)
  	    name = IDENTIFIER_POINTER (decl->u.id);
+ 	  if (first_non_attr_kind == cdk_attrs)
+ 	    first_non_attr_kind = decl->kind;
  	  decl = 0;
  	  break;
  
*************** grokdeclarator (const struct c_declarato
*** 4107,4113 ****
        if (volatilep > 1)
  	pedwarn ("duplicate %<volatile%>");
      }
!   if (!flag_gen_aux_info && (TYPE_QUALS (element_type)))
      type = TYPE_MAIN_VARIANT (type);
    type_quals = ((constp ? TYPE_QUAL_CONST : 0)
  		| (restrictp ? TYPE_QUAL_RESTRICT : 0)
--- 4113,4121 ----
        if (volatilep > 1)
  	pedwarn ("duplicate %<volatile%>");
      }
!   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)
Index: gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-1.c
===================================================================
*** /dev/null	1970-01-01 00:00:00.000000000 +0000
--- gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-1.c	2011-03-21 16:41:08.000000000 +0100
***************
*** 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 } } */
Index: gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-2.c
===================================================================
*** /dev/null	1970-01-01 00:00:00.000000000 +0000
--- gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-2.c	2011-03-21 16:41:08.000000000 +0100
***************
*** 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 } } */
Index: gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-3.c
===================================================================
*** /dev/null	1970-01-01 00:00:00.000000000 +0000
--- gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-3.c	2011-03-21 16:41:08.000000000 +0100
***************
*** 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 } } */
Index: gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-4.c
===================================================================
*** /dev/null	1970-01-01 00:00:00.000000000 +0000
--- gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-4.c	2011-03-21 16:41:08.000000000 +0100
***************
*** 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 } } */
openSUSE Build Service is sponsored by