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

Pretyping rejects too many assignements to const ptr #176

Closed
vbgl opened this issue Jun 22, 2022 · 4 comments
Closed

Pretyping rejects too many assignements to const ptr #176

vbgl opened this issue Jun 22, 2022 · 4 comments

Comments

@vbgl
Copy link
Member

vbgl commented Jun 22, 2022

The following program is rejected:

line 6 (2-3):
typing error: Cannot write to the constant pointer p

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

I believe it should be accepted.

@eponier
Copy link
Contributor

eponier commented Jun 22, 2022

Hum, indeed there is a difference between a mutable pointer to const data and a const pointer to mutable data. If reg const ptr means the first, we must accept this example.

@eponier
Copy link
Contributor

eponier commented Jun 22, 2022

It should be easy to fix. Are already looking into that or do you want me to give it a try?

@vbgl
Copy link
Member Author

vbgl commented Jun 22, 2022

Your help is welcome (I won’t work on a fix today)! I think you’ll have to look at line 1220 of pretyping.ml.

@vbgl
Copy link
Member Author

vbgl commented Jun 22, 2022

See #178

@vbgl vbgl closed this as completed Jun 30, 2022
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

2 participants