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++] Fix 22454


I've installed this patch, mainline & 4.0 to fix 22454, a regression caused by an over eager assert.

booted & tested on i686-pc-linux-gnu.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2005-08-24  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/22454
	* parser.c (cp_lexer_peek_nth_token): Relax assert.

2005-08-24  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/22454
	* g++.dg/parse/crash29.C: New.

Index: cp/parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.350
diff -c -3 -p -r1.350 parser.c
*** cp/parser.c	19 Aug 2005 19:08:08 -0000	1.350
--- cp/parser.c	24 Aug 2005 10:17:25 -0000
*************** cp_lexer_peek_nth_token (cp_lexer* lexer
*** 497,510 ****
    cp_token *token;
  
    /* N is 1-based, not zero-based.  */
!   gcc_assert (n > 0 && lexer->next_token != &eof_token);
! 
    if (cp_lexer_debugging_p (lexer))
      fprintf (cp_lexer_debug_stream,
  	     "cp_lexer: peeking ahead %ld at token: ", (long)n);
  
    --n;
    token = lexer->next_token;
    while (n != 0)
      {
        ++token;
--- 497,511 ----
    cp_token *token;
  
    /* N is 1-based, not zero-based.  */
!   gcc_assert (n > 0);
!   
    if (cp_lexer_debugging_p (lexer))
      fprintf (cp_lexer_debug_stream,
  	     "cp_lexer: peeking ahead %ld at token: ", (long)n);
  
    --n;
    token = lexer->next_token;
+   gcc_assert (!n || token != &eof_token);
    while (n != 0)
      {
        ++token;
Index: testsuite/g++.dg/parse/crash29.C
===================================================================
RCS file: testsuite/g++.dg/parse/crash29.C
diff -N testsuite/g++.dg/parse/crash29.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/parse/crash29.C	24 Aug 2005 10:19:27 -0000
***************
*** 0 ****
--- 1,10 ----
+ // Copyright (C) 2005 Free Software Foundation, Inc.
+ // Contributed by Nathan Sidwell 23 Aug 2005 <nathan@codesourcery.com>
+ 
+ // PR 22454: ICE
+ // Origin: Volker Reichelt reichelt@gcc.gnu.org
+ 
+ template<int> struct A
+ {
+     A(void* = &operator new);
+ };

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