deepjava / compiler

deep compiler
Apache License 2.0
4 stars 5 forks source link

Object function fails to compile when starting with endless loop #15

Open ursgraf opened 1 year ago

ursgraf commented 1 year ago

check with https://gitlab.ost.ch/tech/inf/teaching/sysp/fachausbildung/mikrocontroller/musterloesungen/-/blob/main/src/sysp/fachausb/wifi/WifiReceiverLED.java

ursgraf commented 1 year ago

while (true) { IntPacket.Type type = wifi.intPacket.readInt();            if (null == null) break;            if (type == IntPacket.Type.None) break; produces an internal error during: "Launching MusterLsg.deep". Cannot invoke "Object.equals(Object)" because "this.idom" is null when if(null == null) comes before readInt() it works fine

ursgraf commented 1 year ago

What happens? Let's look at another example: int c; Object o; public void m3() { while (true) { if (null == null) {c = 100;} else if (o == null) {c = 200; break;} } }

the cfg is determined to be: CFGNode nr:0 [0:6], is loop header, bckwd branches=1, idom=null, ref=1, visited:false predecessor: [0:6] successor: [0:6]

CFGNode nr:1 [16:23], idom=null, ref=0, visited:false predecessor: successor:

That looks reasonable: the first node is an endless loop with no connection to the second node. When calculating the SSA these nodes get sorted which fails in that particular case