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

translate-c and pointer alignment #2313

Closed
daurnimator opened this issue Apr 20, 2019 · 0 comments · Fixed by #2318
Closed

translate-c and pointer alignment #2313

daurnimator opened this issue Apr 20, 2019 · 0 comments · Fixed by #2318
Labels
bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@daurnimator
Copy link
Contributor

I ran zig translate-c -isystem /usr/include on lpeg's lptree.c and it successfully generated a zig file.

However, trying to build it as a library zig build-lib translated.zig results in:

/home/daurnimator/src/zig-peg/translated.zig:868:12: error: cast increases pointer alignment
    return @ptrCast([*c]Pattern, luaL_checkudata(L, idx, c"lpeg-pattern"));
           ^
/home/daurnimator/src/zig-peg/translated.zig:868:49: note: '?*c_void' has alignment 1
    return @ptrCast([*c]Pattern, luaL_checkudata(L, idx, c"lpeg-pattern"));
                                                ^
/home/daurnimator/src/zig-peg/translated.zig:868:21: note: '[*c]struct_Pattern' has alignment 8
    return @ptrCast([*c]Pattern, luaL_checkudata(L, idx, c"lpeg-pattern"));
                    ^

I assume zig translate-c needs to gain support for emitting alignment casts?

Note, this error is also reported as part of #2257 (comment)

@andrewrk andrewrk added this to the 0.6.0 milestone Apr 21, 2019
@andrewrk andrewrk added the bug Observed behavior contradicts documented or intended behavior label Apr 21, 2019
@andrewrk andrewrk modified the milestones: 0.6.0, 0.5.0 Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants