optimization/769: loop index at for loop exit is wrong

eric.pouech@wanadoo.fr eric.pouech@wanadoo.fr
Fri Nov 10 12:26:00 GMT 2000


>Number:         769
>Category:       optimization
>Synopsis:       loop index at for loop exit is wrong
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 10 12:26:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Eric Pouech
>Release:        gcc version 2.95.1 19990816 (release)
>Organization:
>Environment:
Linux erato 2.2.9-27mdk #1 Mon Jun 14 16:44:05 CEST 1999 i686 unknown
running Mandrake
>Description:
the generated code is not correct
the content of array L should be {1,2,3,4} 
after the instructions, but it's {1,2,2,4}
This appears only when -O2 (and above) is used. 
However using -O2 -fno-strength-reduce does produce a correct output.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="aa.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="aa.c"

aW50CW1haW4oKQp7CglpbnQJaTsKCXN0YXRpYyBpbnQJTFs0XSA9IHswLDEsMiwzfTsKCgoJZm9y
IChpID0gMDsgaSA8IDM7IGkrKykgTFtpXSA9IExbaSArIDFdOwoJTFtpXSA9IDQ7CgoJcHJpbnRm
KCIlZFxuIiwgTFsyXSk7CglyZXR1cm4gTFsyXSA9PSAzOwp9Cg==


More information about the Gcc-bugs mailing list