java/4489: bytecode generation endless loop with certain switch() exprs

apbianco@redhat.com apbianco@redhat.com
Fri Oct 5 19:56:00 GMT 2001


>Number:         4489
>Category:       java
>Synopsis:       bytecode generation endless loop with certain switch() exprs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 05 19:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Alex Petit-Bianco
>Release:        unknown-1.0
>Organization:
>Environment:
all platforms
>Description:
Consider the following test case:

class Switch {
    void foo (int keyBits, int blockBits) {
      switch (keyBits >= blockBits ? keyBits : blockBits) {
	case 0:
	    break;
	case 1:
	    break;
	}
    }
}

It sends the bytecode generator into a endless loop.
Somethings appears to go wrong when the blocks are being
re-arranged in gcc/java/jcf-write.c:1814. 
>How-To-Repeat:
$ gcj -C Switch.java
>Fix:
Use a temporary variable to compute the expression the
switch is operating on.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="dummy"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="dummy"



More information about the Gcc-bugs mailing list