c/3328: wrong code with Optimization '-O'

Andreas.Krakowczyk@fujitsu-siemens.com Andreas.Krakowczyk@fujitsu-siemens.com
Thu Jun 21 07:26:00 GMT 2001


>Number:         3328
>Category:       c
>Synopsis:       wrong code with Optimization '-O'
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 21 07:26:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Andreas Krakowczyk
>Release:        gcc-3.0
>Organization:
>Environment:
sun-sparc-solaris2.8
>Description:
Strange behaviour of code, works without optimization, but not with '-O'.
Rearranging code leads to not working at all or always working.
>How-To-Repeat:
gcc -O bug5.c && ./a.out
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-unknown-content-type-c_auto_file; name="bug5.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bug5.c"

Y2hhciAqYWN0ID0gMDsKaW50IGZhaWw7CmludCBwcmludChpbnQgbGluZSkgeyBpZiAoZmFpbCAh
PSAwKSBwcmludGYoImxpbmUgJWQ6IGZhaWxlZCBhdDogJXNcbiIsIGxpbmUsIGFjdCk7IH0KbWFp
bihpbnQgYXJnYywgY2hhciAqKmFyZ3YpCnsKICAgICAgICByZWdpc3RlciBpbnQgcmkwID0gMjE0
NzQ4MzY0NzsKICAgICAgICByZWdpc3RlciB1bnNpZ25lZCBzaG9ydCByUzAgPSA2NTUzNDsKICAg
ICAgICByaTAgPSByaTAgJSArK3JTMDsKICAgICAgICB7IGlmIChhY3QgPT0gKGNoYXIgKikwKSBh
Y3QgPSAicmkwID09IDMyNzY3IjsgZmFpbCA9ICEocmkwID09IDMyNzY3KTsgcHJpbnQoOSk7IH07
CiAgICAgICAgZXhpdChmYWlsKTsKfQo=



More information about the Gcc-bugs mailing list