This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] PR 2719, demangler crash
- From: DJ Delorie <dj at redhat dot com>
- To: mark at codesourcery dot com
- Cc: rodrigc at mediaone dot net, gcc-patches at gcc dot gnu dot org
- Date: Wed, 12 Dec 2001 18:12:15 -0500
- Subject: Re: [PATCH] PR 2719, demangler crash
- References: <email@example.com>
> 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.
> Even better would be to say:
> if (INTMAX / 10 < count)
> before the:
> count *= 10
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.