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

Print scale in "invalid scale" error #949

Closed
sarranz opened this issue Oct 30, 2024 · 1 comment · Fixed by #951
Closed

Print scale in "invalid scale" error #949

sarranz opened this issue Oct 30, 2024 · 1 comment · Fixed by #951

Comments

@sarranz
Copy link
Collaborator

sarranz commented Oct 30, 2024

The following code

u256[1] a = { 0 };

export
fn main() -> reg u256 {
    reg ptr u256[1] p;
    p = a;

    reg u64 i;
    i = 0;

    reg u256 x;
    x = p[i];

    return x;
}

gives
compilation error in function main: asmgen: invalid scale
which is a bit confusing until you remember that i is being scaled by 32. If we access the array instead of a pointer, we get a beautiful compilation error in function main: asmgen: Invalid global address : (RIP +64u ((((64u) 32) *64u RAX) +64u ((64u) 0))) where we see the 32.
Can we print the invalid scale in the error?

@vbgl vbgl self-assigned this Oct 30, 2024
@vbgl vbgl added this to the 2024.07.2 milestone Oct 30, 2024
@vbgl
Copy link
Member

vbgl commented Oct 30, 2024

Can we print the invalid scale in the error?

This seems doable.

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

Successfully merging a pull request may close this issue.

2 participants