Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message in stack alloc for stack ptr #843

Open
sarranz opened this issue Jun 19, 2024 · 0 comments
Open

Better error message in stack alloc for stack ptr #843

sarranz opened this issue Jun 19, 2024 · 0 comments

Comments

@sarranz
Copy link
Collaborator

sarranz commented Jun 19, 2024

This program

export fn main() -> () {
    stack u64 x;
    x = 0;
    [x] = 0;
}

gives

compilation error in function main:
stack allocation: x (defined at "ble.jazz", line 3 (4-5)) is a stack variable,
but a reg variable is expected

which makes sense.

But this one

export fn main() -> reg u64 {
    stack u64[1] a;
    stack ptr u64[1] pa;
    pa = a;
    pa[0] = 0;
    reg u64 r;
    r = pa[0];
    return r;
}

gives

compilation error in function main:
stack allocation: pa (defined at "ble.jazz", line 4 (4-6)) is a stack pointer, it should
not appear in an expression

where it's not clear that the problem is that it is stack instead of reg, and also not clear where the expression part comes from (I can't tell from the code either). Doesn't the first error message work for both cases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant