This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/8681: Generates unneeded test
- From: rf13 at inf dot tu-dresden dot de
- To: gcc-gnats at gcc dot gnu dot org
- Date: 22 Nov 2002 17:38:27 -0000
- Subject: c/8681: Generates unneeded test
- Reply-to: rf13 at inf dot tu-dresden dot de
>Number: 8681
>Category: c
>Synopsis: Generates unneeded test
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Fri Nov 22 09:46:03 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: rf13@inf.tu-dresden.de
>Release: gcc-3.2
>Organization:
>Environment:
Linux 2.4.18-PPP i686,glibc-2.2.4-18.7.0.6
>Description:
The compiler should remove the test for "i<0" in the loop body. Nobody can change i and the range of i is known.
>How-To-Repeat:
gcc -O3 -S foobar.c
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="foobar.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="foobar.c"
CiNkZWZpbmUgTiAxMDAwMAoKaW50IHN1bShpbnQgKnApCnsKICBpbnQgaSwgcmVzdWx0ID0gMDsK
CiAgZm9yIChpID0gMDsgaSA8IE47IGkrKykgewogICAgaWYgKGkgPCAwKSB7CiAgICAgIHJlc3Vs
dCA9IDA7CiAgICB9CiAgICByZXN1bHQgKz0gcFtpXTsKICB9CiAgcmV0dXJuIHJlc3VsdDsKfQo=