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]

Re: [C++ Patch] PR 31747


Mark Mitchell wrote:
> Paolo Carlini wrote:
>
>   
>> 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.
>>     
>
> This is OK, but you might as well move the
> declspecs->conflicting_specifier_p check all the way to the top of
> grokdeclarator. 
Thanks. I moved the check way up, as soon as 'name' becomes available,
after another similar check on declspecs.

Tested x86_64-linux, committed to mainline.

Paolo.

////////////////
cp/
2007-10-26  Paolo Carlini  <pcarlini@suse.de>

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

testsuite/
2007-10-26  Paolo Carlini  <pcarlini@suse.de>

	PR c++/31747
	* g++.dg/parse/crash39.C: New.
Index: testsuite/g++.dg/parse/crash39.C
===================================================================
*** testsuite/g++.dg/parse/crash39.C	(revision 0)
--- testsuite/g++.dg/parse/crash39.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 129646)
--- cp/decl.c	(working copy)
*************** grokdeclarator (const cp_declarator *dec
*** 7552,7557 ****
--- 7552,7563 ----
        return error_mark_node;
      }
  
+   if (declspecs->conflicting_specifiers_p)
+     {
+       error ("conflicting specifiers in declaration of %qs", name);
+       return error_mark_node;
+     }
+ 
    /* Extract the basic type from the decl-specifier-seq.  */
    type = declspecs->type;
    if (type == error_mark_node)
*************** grokdeclarator (const cp_declarator *dec
*** 7846,7860 ****
        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
--- 7852,7861 ----
        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]