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

Wrong result for nested type #21

Open
JanisEst opened this issue Jan 26, 2019 · 4 comments · May be fixed by #25
Open

Wrong result for nested type #21

JanisEst opened this issue Jan 26, 2019 · 4 comments · May be fixed by #25

Comments

@JanisEst
Copy link

Both

Pointer(ArrayOf(Pointer(POD(np.float32, "xxx")), 2)),
Pointer(Pointer(ArrayOf(POD(np.float32, "yyy"), 2))),

result in

float **xxx[2];
float **yyy[2];

The expected result is

float *(*xxx)[2];
float (**xxx)[2];
@inducer
Copy link
Owner

inducer commented Sep 30, 2019

Thanks for the report, and sorry about the delay in responding. Could you take a look at #23 , especially since it disagrees with your proposed correct solution (the second one)?

@inducer
Copy link
Owner

inducer commented Oct 9, 2019

I had to revert #23 for the time being as it caused a bit more breakage than anticipated. #25 is the new version.

@inducer inducer reopened this Oct 9, 2019
@JanisEst
Copy link
Author

JanisEst commented Oct 9, 2019

Thank you for both fixes but I'm not sure if it is correct now.

import cgen as c

x = c.Pointer(c.ArrayOf(c.Value("float", "temp"), 2))
print(x) # float *(temp[2]);
x = c.ArrayOf(c.Pointer(c.Value("float", "temp")), 2)
print(x) # float (*temp)[2];

If I understand this library correct the first x should be a pointer to array[2] of float and the second should be an array[2] of pointer to float. The generated code is the opposite.

@inducer
Copy link
Owner

inducer commented Oct 9, 2019

cc @kaushikcfd

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

Successfully merging a pull request may close this issue.

2 participants