Julgodis / Cupcake-Compiler

A compiler for Jonathan Blows new programming language JAI.
MIT License
28 stars 3 forks source link

"Internal Compiler Error" when returning from void function #1

Open catinwarmhands opened 6 years ago

catinwarmhands commented 6 years ago

This code:

#import "modules/Print.jai"

test :: () {
    print("Hello");
    return;
    print(" world");
}

main :: () {
    test();
}

#run main()

run with cupcake mytest.jai produces this error:

Cupcake (v0.1-alpha)
Assertion failed at ..\src\ssa\ssa_realloc.cpp:406 inside coloring_spill_find
Condition: false
Internal Compiler Error : Invalid Code Path

Looks like return; crushes interpreter.

catinwarmhands commented 6 years ago

Also output.cpp is not compiling because a lot of undeclarated indetifiers stuff.

Julgodis commented 6 years ago

I don't have the source code for the currently release version available, which makes the debugging hard. The positive thing is that the newer version (not publicly released yet) runs this code without problem.

I don't think this bug is very imported but if you disagree please say so, and I can release the newer version.

Also output.cpp is not compiling because a lot of undeclarated indetifiers stuff.

Does this only happen in this case?

catinwarmhands commented 6 years ago

It happen even in this simple hello-world example:

#import "modules/Print.jai"
main :: () {
    print("Hello, Cupcake!");
}
#run main()

Output: output.cpp errors in output.cpp (most of it is just warnings, but there is 5 errors "use of undeclared identifier")

I would be happy to see newer version! 😄