c/3376: optimised code wrong in simple for statement

alatham@flexsys-group.com alatham@flexsys-group.com
Fri Jun 22 10:56:00 GMT 2001


>Number:         3376
>Category:       c
>Synopsis:       optimised code wrong in simple for statement
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 22 10:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Allan Latham
>Release:        2.96 Red Hat  (for info: NOT a problem in 2.95.3 Suse)
>Organization:
>Environment:
Red Hat 7.0.1J on i586
>Description:
cc -o Atest Atest.c works as expected
cc -O2 -o Atest Atest.c fails

The optimised version pass only one time thru the loop and reports the answer (variable se) as -1 when it should be 1.

>How-To-Repeat:
Compile and run the short test program with gcc 2.96
>Fix:
Recode as in the example.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list