This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] PR 2719, demangler crash
- From: Mark Mitchell <mark at codesourcery dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: "rodrigc at mediaone dot net" <rodrigc at mediaone dot net>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 12 Dec 2001 16:20:32 -0800
- Subject: Re: [PATCH] PR 2719, demangler crash
--On Wednesday, December 12, 2001 06:12:15 PM -0500 DJ Delorie
>> which I suspect should say:
>> if ((count % 10) != 0 || count < 0)
> The extra logic isn't needed. We just multiplied by 10; any negative
> result *must* be non-modulo 10. And overflow may create a positive
> result depending on the bit patterns, so testing for negative isn't
> going to help anyway.
Well, then, I don't see how we ever get to having a negative value
for count. It starts at zero, gets multiplied by 10, and gets
added to. Oh, I guess it could be just before overflow before the
final digit; good, I didn't see that.
> Yeah, that would be better. A similar test could be used for the
> final digit, although it would be slightly more complicated, and the
> negative test handles all the possible cases anyway.
> But the existing tests should work fine for any base-2 computer.
It's technically non-conforming though; there's no guarantee about
overflow of signed arithmetic. On the mainline, this should be fixed
to use INTMAX.
Mark Mitchell firstname.lastname@example.org
CodeSourcery, LLC http://www.codesourcery.com