This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

optimization/10078: bad code generated with optimisation.


>Number:         10078
>Category:       optimization
>Synopsis:       bad code generated with optimisation.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 14 10:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     ac at m2000 dot fr
>Release:        gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
>Organization:
>Environment:
Linux machine 2.4.18-14smp #1 SMP Wed Sep 4 11:55:37 EDT 2002 i686 athlon i386 GNU/Linux
>Description:
When compiled with -O or -O2, this program return the last greatest value intead of the first...
>How-To-Repeat:
When compiled with 'gcc -Wall bug-20030313.c' you get the correct result (return == 0), when compiled with 'gcc -Wall -O2 bug-20030313.c' you get the wrong result (return != 0).
>Fix:

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

CnN0YXRpYyBkb3VibGUgb2dmKGludCBtLCBpbnQgZCkKewoJcmV0dXJuIG0gJSAxMCArIGQgJSA0
ICogMC4xOwp9CgpzdGF0aWMgZG91YmxlIGNnZihpbnQgbSwgaW50IGQpCnsKCXJldHVybiBtICUg
NSArIGQgJSAyICogMC4xOwp9CgppbnQgbWFpbigpCnsKCWludCBtLCBibSA9IC0xOwoJaW50IGQs
IGJkID0gLTE7Cglkb3VibGUgb2csIGJvZyA9IC0xLjA7Cglkb3VibGUgY2csIGJjZyA9IC0xLjA7
CgoJZm9yIChtID0gMDsgbSAhPSAyMDsgKyttKSB7CgkJZm9yIChkID0gMDsgZCA8IDg7ICsrZCkg
ewoJCQlvZyA9IG9nZihtLCBkKTsgCgkJCWNnID0gY2dmKG0sIGQpOwoJCQlpZiAob2cgPiBib2cp
IHsKCQkJCWJvZyA9IG9nOyBiY2cgPSBjZzsgYm0gPSBtOyBiZCA9IGQ7CgkJCX0gZWxzZSBpZiAo
b2cgPT0gYm9nICYmIGNnID4gYmNnKSB7CgkJCQliY2cgPSBjZzsgYm0gPSBtOyBiZCA9IGQ7CgkJ
CX0KCQl9Cgl9CgoJcmV0dXJuIGJtICE9IDkgfHwgYmQgIT0gMzsKfQo=


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]