Implement implicit returns #6
Labels
A-backend-clif
Area: the Cranelift backend
C-bug-report
Category: bug report
C-feature-tracking
Category: tracking a planned feature which is not yet implemented
M-compiler-panic
Dealing with a compiler panic/crash
P-high
Priority: should ship in the earliest possible release
Milestone
Currently, if a function doesn't return, the compiler panics due to Cranelift's verification pass.
Instead, the compiler should implicitly return from each function. If the function should return a value, it should return uninitialized memory instead.
For basic types such as integers,
0
shall be returned as a default, similar to C.This will eventually be replaced with a check that doesn't allow a function to return implicitly if it returns a value, and a function would have to explicitly return
uninit
instead:Equivalent to the following C code:
The text was updated successfully, but these errors were encountered: