public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Carlo Wood <carlo@alinoe.com>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: c++/5390: Libiberty fails to demangle multi-digit template parameters.
Date: Tue, 11 Mar 2003 02:26:00 -0000	[thread overview]
Message-ID: <20030311022601.12508.qmail@sources.redhat.com> (raw)

The following reply was made to PR c++/5390; it has been noted by GNATS.

From: Carlo Wood <carlo@alinoe.com>
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org, dj@redhat.com
Subject: Re: c++/5390: Libiberty fails to demangle multi-digit template parameters.
Date: Tue, 11 Mar 2003 03:23:41 +0100

 --zhXaljGHf11kAtnf
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Mon, Mar 10, 2003 at 03:03:05PM -0600, Wolfgang Bangerth wrote:
 > >  So, as far as I am concerned you can close this PR.
 > 
 > Does this still hold given DJ's mail?
 > 
 > > (Personally, I'd fix it though if I were you - but I am a perfectionist).
 > 
 > I might if I could. I have no knowledge of gcc, libiberty, etc at all. My 
 > place is gnats, beyond that I can only try to get patch creators and 
 > reviewers into contact -- usually a fruitless endeavor...
 
 I tested it again and, as I've written to DJ in private, it seems
 that my patch WAS applied more or less to gcc version 3.1.
 However, the way it is now is that it doesn't work for negative
 template integrals less than -9.
 
 For example:
 
 /usr/src/gcc/gcc-cvs-3.3/libiberty>echo 'main(int argc, char* argv[]) { printf("%s\n", cplus_demangle(argv[1], 3)); }' > main.c
 /usr/src/gcc/gcc-cvs-3.3/libiberty>gcc -I../include cplus-dem.c safe-ctype.c xmalloc.c xexit.c xstrdup.c cp-demangle.c dyn-string.c main.c
 /usr/src/gcc/gcc-cvs-3.3/libiberty>a.out X__FGt3Bar1im10i
 X(Bar<-1>, , int)
 
 I corrected cplus-dem.c again to completely reflect my original patch
 after which I get correctly:
 
 /usr/src/gcc/gcc-cvs-3.3/libiberty>a.out X__FGt3Bar1im10i
 X(Bar<-10>, int)
 
 
 The new diff is attached.
 
 Log entry:
 
 
 2003-03-10  Carlo Wood  <carlo@gnu.org>
 
         * cplus-dem.c (demangle_integral_value): Correction to reflect
 	patch of 2002-01-10 in order to also make negative multi-digits
 	without leading underscore work.
 
 -- 
 Carlo Wood <carlo@alinoe.com>
 
 --zhXaljGHf11kAtnf
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="dem3.diff"
 
 Index: cplus-dem.c
 ===================================================================
 RCS file: /cvsroot/gcc/gcc/libiberty/cplus-dem.c,v
 retrieving revision 1.89.4.1
 diff -u -d -p -r1.89.4.1 cplus-dem.c
 --- cplus-dem.c	4 Mar 2003 02:57:48 -0000	1.89.4.1
 +++ cplus-dem.c	11 Mar 2003 02:07:23 -0000
 @@ -1797,31 +1797,34 @@ demangle_integral_value (work, mangled, 
  
        success = 0;
  
 -      /* Negative numbers are indicated with a leading `m'.  */
 -      if (**mangled == 'm')
 -	{
 -	  string_appendn (s, "-", 1);
 -	  (*mangled)++;
 -	}
 -      else if (mangled[0][0] == '_' && mangled[0][1] == 'm')
 -	{
 -	  /* Since consume_count_with_underscores does not handle the
 -	     `m'-prefix we must do it here, using consume_count and
 -	     adjusting underscores: we have to consume the underscore
 -	     matching the prepended one.  */
 -	  multidigit_without_leading_underscore = 1;
 -	  string_appendn (s, "-", 1);
 -	  (*mangled) += 2;
 -	}
 -      else if (**mangled == '_')
 -	{
 -	  /* Do not consume a following underscore;
 -	     multidigit_without_leading_underscore will consume what should be
 -	     consumed.  */
 -	  leave_following_underscore = 1;
 +      if (**mangled == '_')
 +        {
 +	  if (mangled[0][1] == 'm')
 +	    {
 +	      /* Since consume_count_with_underscores does not handle the
 +		 `m'-prefix we must do it here, using consume_count and
 +		 adjusting underscores: we have to consume the underscore
 +		 matching the prepended one.  */
 +	      multidigit_without_leading_underscore = 1;
 +	      string_appendn (s, "-", 1);
 +	      (*mangled) += 2;
 +	    }
 +	  else
 +	    {
 +	      /* Do not consume a following underscore;
 +	         consume_count_with_underscores will consume what
 +	         should be consumed.  */
 +	      leave_following_underscore = 1;
 +	    }
  	}
        else
  	{
 +	  /* Negative numbers are indicated with a leading `m'.  */
 +	  if (**mangled == 'm')
 +	  {
 +	    string_appendn (s, "-", 1);
 +	    (*mangled)++;
 +	  }
  	  /* Since consume_count_with_underscores does not handle
  	     multi-digit numbers that do not start with an underscore,
  	     and this number can be an integer template parameter,
 @@ -1862,7 +1865,7 @@ demangle_integral_value (work, mangled, 
  	  /* All is well.  */
  	  success = 1;
  	}
 -    }
 +      }
  
    return success;
  }
 
 --zhXaljGHf11kAtnf--


             reply	other threads:[~2003-03-11  2:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-11  2:26 Carlo Wood [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-11 20:06 DJ Delorie
2003-03-11 20:06 Wolfgang Bangerth
2003-03-10 21:06 Wolfgang Bangerth
2003-03-07 23:16 Carlo Wood
2003-03-07 17:26 DJ Delorie
2003-03-07 16:06 Wolfgang Bangerth
2003-03-07 12:36 Carlo Wood
2003-03-07  2:26 bangerth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030311022601.12508.qmail@sources.redhat.com \
    --to=carlo@alinoe.com \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).