Thanks to visit codestin.com
Credit goes to github.com

Skip to content

NPD with GOTO #30

@mikevoronov

Description

@mikevoronov

I have stumbled with NPD during compilation of this example. It seems that this exception caused by generation of stack locals after GOTO operation: the field locals sets to null by asm after GOTO and then processing of iconst_1 operation tries to invoke get on null object here

localsRead.put(var, locals.get(var));

The stack trace is

visitVarInsn:334, Splitter$StackAndLocalTrackingAdapter (asmble.compile.jvm.msplit)
accept:74, VarInsnNode (org.objectweb.asm.tree)
splitPointFromInfo:267, Splitter$Iter (asmble.compile.jvm.msplit)
longestForCurrIndex:152, Splitter$Iter (asmble.compile.jvm.msplit)
nextOrNull:129, Splitter$Iter (asmble.compile.jvm.msplit)
hasNext:107, Splitter$Iter (asmble.compile.jvm.msplit)
split:52, SplitMethod (asmble.compile.jvm.msplit)
split:31, SplitMethod (asmble.compile.jvm.msplit)
fromClassNode:32, AsmToBinary (asmble.compile.jvm)
fromClassNode$default:16, AsmToBinary (asmble.compile.jvm)
run:72, Compile (asmble.cli)
run:10, Compile (asmble.cli)
runWithArgs:17, Command (asmble.cli)
main:35, MainKt (asmble.cli)

Also tested with the latest asm - the same result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions