gcj/161: Source parser miscompiles loops when using "-O"
bryce@albatross.co.nz
bryce@albatross.co.nz
Sat Mar 4 23:00:00 GMT 2000
>Number: 161
>Category: gcj
>Synopsis: Source parser miscompiles loops when using "-O"
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Mar 04 23:00:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Bryce McKinlay
>Release: gcc version 2.96 20000303 (experimental), also 2.95.2
>Organization:
>Environment:
Redhat 6.1
>Description:
The presence of certain combinations of "continue"
and "break" within loops results in incorrect runtime
behavior and/or crashes when compiling from source with
"-O".
>How-To-Repeat:
Compile and run the attached test case. In this example,
the crashes seem to occur on the 'break' statement after
the loop completes and one or more 'continue's have already
been executed, however this is a simplification of a more
complex loop in some of my code where I'm seeing all kinds
of bizzare behavior - not just on 'break' - but the
presence of 'continue' definatly seems to be a factor.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="Loop.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Loop.java"
aW1wb3J0IGphdmEudXRpbC4qOwoKcHVibGljIGNsYXNzIExvb3AKewogIHN0YXRpYyBWZWN0b3Ig
c3R1ZmYgPSBuZXcgVmVjdG9yKCk7CgogIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZyBh
cmdzW10pCiAgewogICAgc3R1ZmYuYWRkRWxlbWVudCgiYmxvc3NvbSIpOwogICAgc3R1ZmYuYWRk
RWxlbWVudCgiIik7CiAgICBzdHVmZi5hZGRFbGVtZW50KCJidWJibGVzIik7CiAgICBzdHVmZi5h
ZGRFbGVtZW50KCJ6enoiKTsgICAgCiAgICBzdHVmZi5hZGRFbGVtZW50KCJ6enoiKTsgICAgCiAg
ICBzdHVmZi5hZGRFbGVtZW50KCJidXR0ZXJjdXAiKTsKICAKICAgIFN0cmluZyBuZXh0ID0gIiIs
IGxpbmU7ICAgIAogIAogICAgRW51bWVyYXRpb24gZSA9IHN0dWZmLmVsZW1lbnRzKCk7CiAgCiAg
ICB3aGlsZSAodHJ1ZSkKICAgICAgewkgCiAgICAgICAgaWYgKCFlLmhhc01vcmVFbGVtZW50cygp
KQoJICBicmVhazsJCgoJbGluZSA9IChTdHJpbmcpIGUubmV4dEVsZW1lbnQoKTsKCSAgCSAgCglp
ZiAobGluZS5sZW5ndGgoKSA9PSAwKQoJICBjb250aW51ZTsgIAoKCWlmIChsaW5lLmNoYXJBdCgw
KSAhPSAnYicpCgkgIGNvbnRpbnVlOwoJCglTeXN0ZW0ub3V0LnByaW50bG4obGluZSk7CiAgICAg
IH0KICB9CiAgCn0K
More information about the Java-prs
mailing list