[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another CFG problem.



The code below:

package ptolemy.copernicus.java.test;

public class test {
     public static int s[] = new int[5];

     public static final int foo() {
         int i = 1;
         int startsAt = 0;

         for (;;) {
         MatchLoop:
             do {
                 switch(s[--i]) {
                 default : break;
                 }
             } while(i != startsAt);
         }
     }
}

compiled into the attached class file throws an exception:

Transforming ptolemy.copernicus.java.test... java.lang.NullPointerException
         at soot.coffi.CFG.adjustBranchTargets(CFG.java:735)
         at soot.coffi.CFG.eliminateJsrRets(CFG.java:456)
         at soot.coffi.CFG.<init>(CFG.java:85)
         at soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:87)
         at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:83)
         at soot.SootMethod.retrieveActiveBody(SootMethod.java:276)
         at soot.Main.handleClass(Main.java:1795)
         at soot.Main.run(Main.java:1557)
         at java.lang.Thread.run(Thread.java:484)

It appears that the switch is not being handled properly?
This is a stripped down example of some code generated using JavaCC using 
the standard soot 1.2.2 and jdk1.3.1

Steve

test.class