Cupcake-Compiler icon indicating copy to clipboard operation
Cupcake-Compiler copied to clipboard

"Internal Compiler Error" when returning from void function

Open catinwarmhands opened this issue 6 years ago • 3 comments

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 avatar Mar 12 '18 10:03 catinwarmhands

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

catinwarmhands avatar Mar 12 '18 10:03 catinwarmhands

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?

Julgodis avatar Mar 12 '18 14:03 Julgodis

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! 😄

catinwarmhands avatar Mar 12 '18 18:03 catinwarmhands