This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ Patch] PR 31747


Hi,

apparently a bit more work is needed to untangle some checks in
grokdeclarator (and cleanly fix c++/32056, for example) but in case of
conflicting specifiers makes sense to me just returning error_mark_node,
before the checks specific to certain kinds of declarations.

Tested x86_64-linux, would be mainline and 4_2-branch, to fix a regression.

Paolo.

/////////////////
cp/
2007-09-19  Paolo Carlini  <pcarlini@suse.de>

	PR c++/31747
	* decl.c (grokdeclarator): In case of conflicting specifiers
	just return error_mark_node.

testsuite/
2007-09-19  Paolo Carlini  <pcarlini@suse.de>

	PR c++/31747
	* g++.dg/parse/crash38.C: New.
Index: testsuite/g++.dg/parse/crash38.C
===================================================================
*** testsuite/g++.dg/parse/crash38.C	(revision 0)
--- testsuite/g++.dg/parse/crash38.C	(revision 0)
***************
*** 0 ****
--- 1,3 ----
+ // PR c++/31747
+ 
+ static extern int i; // { dg-error "conflicting specifiers" }
Index: cp/decl.c
===================================================================
*** cp/decl.c	(revision 128584)
--- cp/decl.c	(working copy)
*************** grokdeclarator (const cp_declarator *dec
*** 7763,7768 ****
--- 7769,7780 ----
        virtualp = 0;
      }
  
+   if (declspecs->conflicting_specifiers_p)
+     {
+       error ("conflicting specifiers in declaration of %qs", name);
+       return error_mark_node;
+     }
+ 
    /* Static anonymous unions are dealt with here.  */
    if (staticp && decl_context == TYPENAME
        && declspecs->type
*************** grokdeclarator (const cp_declarator *dec
*** 7780,7794 ****
        error ("multiple storage classes in declaration of %qs", name);
        thread_p = false;
      }
!   if (declspecs->conflicting_specifiers_p)
!     {
!       error ("conflicting specifiers in declaration of %qs", name);
!       storage_class = sc_none;
!     }
!   else if (decl_context != NORMAL
! 	   && ((storage_class != sc_none
! 		&& storage_class != sc_mutable)
! 	       || thread_p))
      {
        if ((decl_context == PARM || decl_context == CATCHPARM)
  	  && (storage_class == sc_register
--- 7792,7801 ----
        error ("multiple storage classes in declaration of %qs", name);
        thread_p = false;
      }
!   if (decl_context != NORMAL
!       && ((storage_class != sc_none
! 	   && storage_class != sc_mutable)
! 	  || thread_p))
      {
        if ((decl_context == PARM || decl_context == CATCHPARM)
  	  && (storage_class == sc_register

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]