-
Notifications
You must be signed in to change notification settings - Fork 420
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
Use-before-def problem in queried argument values (when array types are involved?) #23533
Comments
This works: proc fftplanfactors(n : uint(?w), ufr : [?uD] uint(w))
{
// use uint(w) within the routine
...
} This fails: proc fftplanfactors(ufr : [?uD] uint(?w), n : uint(w))
{
// use uint(w) within the routine
...
} Hope this helps. |
It looks like It's a strange order of operations error... We currently do this strange "stamping out" in the production compiler where any time we encounter The question is whether or not we stamp out overloads for this array type case as well or if we just leave it generic and see what happens... |
It's kind of silly, but I'm just going to extend the current cloning we do today to apply to |
Resolves #23533. Add support for primitive type queries that are embedded in an array type expression, e.g., `x: [...] int(?w)`. During `normalize`, any time the production compiler sees a primitive type query e.g., `int(?w)`, it will opt to stamp out overloads where `w` is replaced by each valid bit width (`8`, `16`, `32`, `64`). This process is repeated recursively for each primitive type query. This PR just extends the above described process to apply to array types that are primitive type queries. This strategy is not ideal, but it is done in the production compiler because the implementation is convenient. I think ideally we would just rely on normal generic instantiation to create only the overloads required by the program. We can wait for this functionality to be supplied by the new frontend. TESTING - [x] `linux64`, `standard` Reviewed by @riftEmber. Thanks!
Thanks for filing this @damianmoz, and for improving the state of things, @dlongnecke-cray! Damian, if you get a chance to try out the fix in your code, please let us know if you're seeing the expected behavior now. |
Next week. Thanks |
Please update the heading/title I have given this if it is imprecise or just plain wrong.
The following complains
It says that w is used before being defined.
The text was updated successfully, but these errors were encountered: