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

Implicit cast from array to vector pointer changes alignment requirement #1237

Closed
cbuttner opened this issue Jul 14, 2024 · 7 comments
Closed
Assignees
Labels
Enhancement Request New feature or request Fixed Needs Verification Fixed, but needs verification that it works
Milestone

Comments

@cbuttner
Copy link
Contributor

cbuttner commented Jul 14, 2024

Not a bug, but:

fn void test(float[<4>]* out) {
  *out *= 2;
}

fn int main(String[] args) {
  float[4] v;
  test(&v); // This implicitly changes the alignment requirement of v
}
@lerno
Copy link
Collaborator

lerno commented Jul 14, 2024

Yes. I'm not sure whether this is wrong though.

@cbuttner
Copy link
Contributor Author

This can go completely unnoticed, in fact it almost did for me, especially when the alignment just happens to match up. Then one day it just crashes and you're left wondering why.
I'm generally not that worried about footguns, but man, you've got to tighten up some of these implicit conversions. I don't even understand what the benefit of this is, saving a few characters needed to type for an explicit cast?

@lerno
Copy link
Collaborator

lerno commented Jul 14, 2024

Indeed. Since the opposite is fine too.

@lerno lerno self-assigned this Jul 14, 2024
@lerno lerno added the Missing Feature Feature that is required for the language label Jul 14, 2024
@lerno lerno added the Fixed Needs Verification Fixed, but needs verification that it works label Jul 14, 2024
@lerno
Copy link
Collaborator

lerno commented Jul 14, 2024

Master is updated.

@lerno lerno added Enhancement Request New feature or request Fixed Needs Verification Fixed, but needs verification that it works and removed Missing Feature Feature that is required for the language Fixed Needs Verification Fixed, but needs verification that it works labels Jul 15, 2024
@lerno
Copy link
Collaborator

lerno commented Jul 15, 2024

Please check that it's working correctly for this and other similar pointer conversions.

@lerno lerno added this to the 0.6.1 milestone Jul 26, 2024
@lerno
Copy link
Collaborator

lerno commented Aug 2, 2024

Is this working?

@cbuttner
Copy link
Contributor Author

cbuttner commented Aug 3, 2024

Yes this works well, thank you.

@cbuttner cbuttner closed this as completed Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Request New feature or request Fixed Needs Verification Fixed, but needs verification that it works
Projects
None yet
Development

No branches or pull requests

2 participants