This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ivopts improvement
- From: Tom de Vries <vries at codesourcery dot com>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: rakdver at kam dot mff dot cuni dot cz, gcc-patches at gcc dot gnu dot org, Bernd Schmidt <bernds at codesourcery dot com>, Maxim Kuvyrkov <maxim at codesourcery dot com>
- Date: Mon, 28 Feb 2011 15:22:10 +0100
- Subject: Re: ivopts improvement
- References: <4D6B6DB9.7050302@codesourcery.com> <4D6B7AFD.6000201@gnu.org>
Hi Paolo,
On 02/28/2011 11:37 AM, Paolo Bonzini wrote:
> On 02/28/2011 10:41 AM, Tom de Vries wrote:
>> The difficulty is that this replacement is only valid under the
>> guarantee that base + n does not overflow.
>
> I think this should be done unconditionally under
> -funsafe-loop-optimizations.
void
f (char *base, unsigned long int i, unsigned long int n)
{
char *p = base + i;
do
{
*p = '\0';
p++;
i++;
}
while (i < n);
}
AFAIU, -funsafe-loop-optimizations allows me to assume that i does not
overflow. Are you saying that -funsafe-loop-optimizations also implies
that p does not overflow?
- Tom