From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas.Krakowczyk@fujitsu-siemens.com To: gcc-gnats@gcc.gnu.org Cc: Erwin.Unruh@fujitsu-siemens.com, Jochen.Canisius@fujitsu-siemens.com Subject: c/3328: wrong code with Optimization '-O' Date: Thu, 21 Jun 2001 07:26:00 -0000 Message-id: <20010621142322.4785.qmail@sourceware.cygnus.com> X-SW-Source: 2001-06/msg00896.html List-Id: >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=