jasmin
jasmin copied to clipboard
The storage modifier of the return type of a function is ignored
If we compile the following function in the glob_array3 branch
inline fn sum (stack u64[2] a) -> stack u64 {
reg u64 r;
r = a[0];
r += a[1];
return r;
}
the stack storage in the type is simply ignored and replace by reg. If we replace stack with either reg ptr or stack ptr, we get the same result. This is a bit confusing.
Maybe this is done on purpose to have a uniform syntax, and it is known that the storage modifier in the return type of a function is ignored and instead inferred from the body of the function, in which case this issue can be marked as invalid, but I prefer to ask.
Benjamin's remark: we should update the type checker!
Yes, the type checker should enforce that the given signature is correct.