This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Optimization failure
- To: kai-egcs-bug at khms dot westfalen dot de
- Subject: Re: Optimization failure
- From: Jeffrey A Law <law at hurl dot cygnus dot com>
- Date: Sun, 28 Feb 1999 12:32:03 -0700
- cc: egcs-bugs at cygnus dot com
- Reply-To: law at cygnus dot com
In message <E10H3Id-0004jn-00@khms.westfalen.de>you write:
> The following example code demonstrates a problem with the optimizer:
> Only the first range of constants is recognized.
>
> I hope this is enough information, but if you need more, just ask :-)
>
> Source (generated by a script, otherwise I would already have hand-optimize > d
> it):
[ ... ]
Yea. This is a problem with the range checking optimizations. I actually
reported problems of this nature soon after the revamped range checking code
was installed into gcc2 (in ~1996).
Basically we build an optimized range test for the first group of
consecutive elements. We'll call that A. Then we try to optimize
(A || (c == 0x7f). There's no additional optimization that can be done, so
we then try
((A || (c == 0x7f)) || (c == 0x80))
And so-on.
I believe the way to fix this is to