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]

java/5941: incorrect "Unreachable statement" error



>Number:         5941
>Category:       java
>Synopsis:       incorrect "Unreachable statement" error
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 13 11:36:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Saurin Shroff
>Release:        GNU Java version 3.0.1 (sparc-sun-solaris2.8)
>Organization:
>Environment:
Sun/Sparc Solaris
>Description:
I get:

hdlFSM.java:448: Unreachable statement.
            for (int i=lowIndex; i <= highIndex; i++) {
                                                       ^
1 error

The variable lowIndex and highIndex are set just before the
loop. Here is the partial code:

    int highIndex = dependency.hdlmGetHighIndex();
    int lowIndex = dependency.hdlmGetLowIndex();

    for (int i=lowIndex; i <= highIndex; i++) {
	if ( dependencyDeclaration.hdlmIsRegister(i) ||
	     dependencyDeclaration.hdlmIsLatch(i) ) {
	    /* encountered a register other then state variable */
	    return true;
	}

Object "dependency" is of type "hdlDependency" which is an
interface. The hdlmGetHighIndex and hdlmGetLowIndex are
methods described in the interface and are implemented in
classes that implement the interface.

There was one similar loop in the file before line 448, but
no error was issued against it.

Here is the command line I used and the result:

% gcj -v -C --encoding=UTF-8 -CLASSPATH /home/shroff/work hdlFSM.java

Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0.1/specs
Configured with: ../configure --with-as=/usr/local/bin/as --with-ld=/usr/local/bin/ld --enable-libgcj
Thread model: posix
gcc version 3.0.1
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0.1/jc1 hdlFSM.java -quiet -dumpbase hdlFSM.java -g1 -version -fencoding=UTF-8 -fencoding=UTF-8 -fCLASSPATH=/home/shroff/work -fsyntax-only -femit-class-files -o /dev/null
GNU Java version 3.0.1 (sparc-sun-solaris2.8)
        compiled by GNU C version 3.0.1.
hdlFSM.java: In class `dualsoft.rules.hdlFSM':
hdlFSM.java: In method `dualsoft.rules.hdlFSM.checkForPIAndNonStateVariables(java.util.Vector,dualsoft.rules.hdlDeclInterface,dualsoft.rules.hdlDeclInterface)':
hdlFSM.java:448: Unreachable statement.
            for (int i=lowIndex; i <= highIndex; i++) {
                                                       ^
1 error

Le me know if you want any other information.

-- Saurin
   shroff@transeda.com

P.S
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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