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 8720


This patch fixes PR 8720, a bug of the reworking of spew.c to play
nice with the GTY stuff.

Tested on i686-pc-linux-gnu, applied on the mainline.

-- 
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2002-12-02  Mark Mitchell  <mark@codesourcery.com>

	PR c++/8720
	* spew.c (remove_last_token): Make sure that last_chunk is set
	correctly.

2002-12-02  Mark Mitchell  <mark@codesourcery.com>

	PR c++/8720
	* g++.dg/parse/defarg1.C: New test.

Index: cp/spew.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/spew.c,v
retrieving revision 1.75
diff -c -p -r1.75 spew.c
*** cp/spew.c	23 Oct 2002 18:38:22 -0000	1.75
--- cp/spew.c	3 Dec 2002 06:25:53 -0000
*************** remove_last_token (t)
*** 1042,1052 ****
    t->last_pos--;
    if (t->last_pos == 0 && t->last_chunk != t->tokens)
      {
!       struct token_chunk **tc;
!       for (tc = &t->tokens; (*tc)->next != NULL; tc = &(*tc)->next)
! 	;
!       *tc = NULL;
!       t->last_pos = ARRAY_SIZE ((*tc)->toks);
      }
    return result;
  }
--- 1042,1054 ----
    t->last_pos--;
    if (t->last_pos == 0 && t->last_chunk != t->tokens)
      {
!       struct token_chunk *c;
!       c = t->tokens;
!       while (c->next != t->last_chunk)
! 	c = c->next;
!       c->next = NULL;
!       t->last_chunk = c;
!       t->last_pos = ARRAY_SIZE (c->toks);
      }
    return result;
  }
Index: testsuite/g++.dg/parse/defarg1.C
===================================================================
RCS file: testsuite/g++.dg/parse/defarg1.C
diff -N testsuite/g++.dg/parse/defarg1.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/parse/defarg1.C	3 Dec 2002 06:25:55 -0000
***************
*** 0 ****
--- 1,5 ----
+ class A
+ {
+ public:
+     A(int nBits = ((int)0x8) | ((int)0x4) | ((int)0x2));
+ };


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