Skip to content

Failing to compile a program in ch22 #226

@dibyendumajumdar

Description

@dibyendumajumdar

This works in ch21 not in ch22:

val fib = {int n ->
    int temp=0;
    int f1=1;
    int f2=1;
    int i=n;
    while( i>1 ){
        temp = f1+f2;
        f1=f2;
        f2=temp;
        i=i-1;
    }
    return f2;
};

fib(10);

I am getting:

Exception in thread "main" java.lang.NullPointerException: Cannot read field "_head" because "ltree" is null
	at com.seaofnodes.simple.node.CFGNode._bltWalk(CFGNode.java:170)
	at com.seaofnodes.simple.node.CFGNode._bltWalk(CFGNode.java:152)
	at com.seaofnodes.simple.node.CFGNode._bltWalk(CFGNode.java:152)
	at com.seaofnodes.simple.node.CFGNode.buildLoopTree(CFGNode.java:143)
	at com.seaofnodes.simple.codegen.CodeGen.loopTree(CodeGen.java:244)
	at com.seaofnodes.simple.Simple.main(Simple.java:233)

I am running this in Simple cmd line with following args:

--dump-after-local-sched -S --cpu x86_64_v2 --abi SystemV

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions