This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
A combiner type optimization is causing a failure
- From: "Pranav Bhandarkar" <pranav dot bhandarkar at gmail dot com>
- To: gcc at gnu dot org
- Date: Thu, 22 Feb 2007 19:26:13 +0530
- Subject: A combiner type optimization is causing a failure
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=OqXg6vBLGD8byHtHtpOaCtBktmhyJuV6YDX8Ut6whnqVth8rqTjHV7UxlwxAXLeLNPSoll4qpiarp7WWCX7jJxp2LeWRUp78hExq/WgHBXpoSJNOP7RyeC0ksM0YKUI0ikeCd3UvC3A1eh9yJT2K155yRCifrmz0r5sSj14065s=
Hello all,
I added a small optimization which does the following . It converts
a = a + 1
if ( a > 0 )
to
if ( a > -1)
a is a signed int.
However this is causing 920612-1.c to fail, which is reproduced below
for convenience.
f(j)int j;{return++j>0;}
main(){ if(f((~0U)>>1)) abort(); exit(0); }
The problem is that this testcase passes the number 2147483647 (int is
4 bytes for my architecture) to which if 1 is added an overflow will
occur. Since I remove the increment operation in 'f' through the
optimization 2147483647 never gets incremented and 'f' always returns
1 and the testcase fails.
My question is that, IMO the test is checking overflow behaviour. Is
it right to have such a test ?
Regards,
Pranav