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 function pointer type #216

Closed
Chronostasys opened this issue Feb 19, 2022 · 1 comment
Closed

Wrong function pointer type #216

Chronostasys opened this issue Feb 19, 2022 · 1 comment

Comments

@Chronostasys
Copy link

Hi,
I'm using this library to build my toy language recently, the experience is awesome. However, things become wired when I try to play with function pointers.
Consider the example in #215 , the ir generated from C has the struct type { i32 (i32, i32)*, double (double)* } which is right and the go code following it shall generate exactly same structure. However, if you print structType.LLString(), the output is { i32 (i32, i32), double (double) }, which is a struct contains two value type rather than pointer.
In my opinion, there might be a mistake in ir.Func‘s type. It should be a pointer type rather than a plain function type. This issue may lead to wrong error message while storing function pointers into variables.

@Chronostasys
Copy link
Author

Chronostasys commented Feb 19, 2022

Oh, I'm really sorry. Seems the type in ir.Func is right. The example above is using function types return from NewFunc call. Thanks again for building this amazing library!

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

No branches or pull requests

1 participant