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]

PATCH: Fix demangler bug


This mangled name (the test at line 2838 in demangle-expected) was
incorrectly demangled:

  _Z3fooiPiPS_PS0_PS1_PS2_PS3_PS4_PS5_PS6_PS7_PS8_PS9_PSA_PSB_PSC_

Tested with "make check" in libibery on i686-pc-linux-gnu.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2003-11-19  Mark Mitchell  <mark@codesourcery.com>

	* cp-demangle.c (demangle_type): Correct thinko in substitution
	processing.

Index: cp-demangle.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/cp-demangle.c,v
retrieving revision 1.49
diff -c -5 -p -r1.49 cp-demangle.c
*** cp-demangle.c	19 Nov 2003 04:06:50 -0000	1.49
--- cp-demangle.c	20 Nov 2003 01:47:57 -0000
*************** demangle_type (dm)
*** 2555,2568 ****
  	break;
  
        case 'S':
  	/* First check if this is a special substitution.  If it is,
  	   this is a <class-enum-type>.  Special substitutions have a
! 	   letter following the `S'; other substitutions have a digit
! 	   or underscore.  */
  	peek_next = peek_char_next (dm);
! 	if (IS_DIGIT (peek_next) || peek_next == '_')
  	  {
  	    RETURN_IF_ERROR (demangle_substitution (dm, &encode_return_type));
  	    
  	    /* The substituted name may have been a template name.
  	       Check if template arguments follow, and if so, demangle
--- 2555,2570 ----
  	break;
  
        case 'S':
  	/* First check if this is a special substitution.  If it is,
  	   this is a <class-enum-type>.  Special substitutions have a
! 	   lower-case letter following the `S'; other substitutions
! 	   have a digit, upper-case letter, or underscore.  */
  	peek_next = peek_char_next (dm);
! 	if (IS_DIGIT (peek_next) 
! 	    || (peek_next >= 'A' && peek_next <= 'Z')
! 	    || peek_next == '_')
  	  {
  	    RETURN_IF_ERROR (demangle_substitution (dm, &encode_return_type));
  	    
  	    /* The substituted name may have been a template name.
  	       Check if template arguments follow, and if so, demangle


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