-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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: error: expected pointer, found '?[*c]c_int' #9917
Comments
I should mention, it also prints this error:
I'm not sure if they're separate or related. |
I'm not familiar enough with Zig to suggest or make a fix here, but I have generated minimal reproducible examples of the above errors. error: expected pointer, found '?[*c]c_int'source codevoid *repr_9917_a(int *arr, int check)
{
void *p = check ? arr : 0;
return p;
} translated codepub export fn repr_9917_a(arg_arr: [*c]c_int, arg_check: c_int) ?*c_void {
var arr = arg_arr;
var check = arg_check;
var p: ?*c_void = @ptrCast(?*c_void, if (check != 0) arr else null);
return p;
} error
error: no align available for type 'c_void'source codevoid ** repr_9917_b(char **out)
{
void **r = (void **) out;
return r;
} translated codepub export fn repr_9917_b(arg_out: [*c][*c]u8) [*c]?*c_void {
var out = arg_out;
var r: [*c]?*c_void = @ptrCast([*c]?*c_void, @alignCast(@import("std").meta.alignment(?*c_void), out));
return r;
} error
Some random references#4686 - using normal pointers (rather than c pointers) for pointers to opaque types |
The first issue is a bug in peer type resolution |
The existing logic for peer type resolution was quite convoluted and buggy. This rewrite makes it much more resilient, readable, and extensible. The algorithm works by first iterating over the types to select a "strategy", then applying that strategy, possibly applying peer resolution recursively. Several new tests have been added to cover cases which the old logic did not correctly handle. Resolves: ziglang#9917 Resolves: ziglang#15644 Resolves: ziglang#15709
The existing logic for peer type resolution was quite convoluted and buggy. This rewrite makes it much more resilient, readable, and extensible. The algorithm works by first iterating over the types to select a "strategy", then applying that strategy, possibly applying peer resolution recursively. The new semantics around PTR for comptime-known fixed-width integers did require some small changes to parts of the compiler, std, and compiler_rt. Regarding the MachO changes, I spoke to @kubkon about how best to do them, and this is what he suggested. Several new tests have been added to cover cases which the old logic did not correctly handle. Resolves: ziglang#9917 Resolves: ziglang#15644 Resolves: ziglang#15709
The existing logic for peer type resolution was quite convoluted and buggy. This rewrite makes it much more resilient, readable, and extensible. The algorithm works by first iterating over the types to select a "strategy", then applying that strategy, possibly applying peer resolution recursively. The new semantics around PTR for comptime-known fixed-width integers did require some small changes to parts of the compiler, std, and compiler_rt. Regarding the MachO changes, I spoke to @kubkon about how best to do them, and this is what he suggested. Several new tests have been added to cover cases which the old logic did not correctly handle. Resolves: ziglang#9917 Resolves: ziglang#15644 Resolves: ziglang#15709
The existing logic for peer type resolution was quite convoluted and buggy. This rewrite makes it much more resilient, readable, and extensible. The algorithm works by first iterating over the types to select a "strategy", then applying that strategy, possibly applying peer resolution recursively. The new semantics around PTR for comptime-known fixed-width integers did require some small changes to parts of the compiler, std, and compiler_rt. Regarding the MachO changes, I spoke to @kubkon about how best to do them, and this is what he suggested. Several new tests have been added to cover cases which the old logic did not correctly handle. Resolves: ziglang#9917 Resolves: ziglang#15644 Resolves: ziglang#15709
The existing logic for peer type resolution was quite convoluted and buggy. This rewrite makes it much more resilient, readable, and extensible. The algorithm works by first iterating over the types to select a "strategy", then applying that strategy, possibly applying peer resolution recursively. The new semantics around PTR for comptime-known fixed-width integers did require some small changes to parts of the compiler, std, and compiler_rt. Regarding the MachO changes, I spoke to @kubkon about how best to do them, and this is what he suggested. Several new tests have been added to cover cases which the old logic did not correctly handle. Resolves: ziglang#9917 Resolves: ziglang#15644 Resolves: ziglang#15709
The existing logic for peer type resolution was quite convoluted and buggy. This rewrite makes it much more resilient, readable, and extensible. The algorithm works by first iterating over the types to select a "strategy", then applying that strategy, possibly applying peer resolution recursively. The new semantics around PTR for comptime-known fixed-width integers did require some small changes to parts of the compiler, std, and compiler_rt. Regarding the MachO changes, I spoke to @kubkon about how best to do them, and this is what he suggested. Several new tests have been added to cover cases which the old logic did not correctly handle. Resolves: ziglang#9917 Resolves: ziglang#15644 Resolves: ziglang#15709
The existing logic for peer type resolution was quite convoluted and buggy. This rewrite makes it much more resilient, readable, and extensible. The algorithm works by first iterating over the types to select a "strategy", then applying that strategy, possibly applying peer resolution recursively. The new semantics around PTR for comptime-known fixed-width integers did require some small changes to parts of the compiler, std, and compiler_rt. Regarding the MachO changes, I spoke to @kubkon about how best to do them, and this is what he suggested. Several new tests have been added to cover cases which the old logic did not correctly handle. Resolves: ziglang#9917 Resolves: ziglang#15644 Resolves: ziglang#15709
The existing logic for peer type resolution was quite convoluted and buggy. This rewrite makes it much more resilient, readable, and extensible. The algorithm works by first iterating over the types to select a "strategy", then applying that strategy, possibly applying peer resolution recursively. The new semantics around PTR for comptime-known fixed-width integers did require some small changes to parts of the compiler, std, and compiler_rt. Regarding the MachO changes, I spoke to @kubkon about how best to do them, and this is what he suggested. Several new tests have been added to cover cases which the old logic did not correctly handle. Resolves: ziglang#9917 Resolves: ziglang#15644 Resolves: ziglang#15709
The existing logic for peer type resolution was quite convoluted and buggy. This rewrite makes it much more resilient, readable, and extensible. The algorithm works by first iterating over the types to select a "strategy", then applying that strategy, possibly applying peer resolution recursively. The new semantics around PTR for comptime-known fixed-width integers did require some small changes to parts of the compiler, std, and compiler_rt. Regarding the MachO changes, I spoke to @kubkon about how best to do them, and this is what he suggested. Several new tests have been added to cover cases which the old logic did not correctly handle. Resolves: ziglang#9917 Resolves: ziglang#15644 Resolves: ziglang#15709
Zig Version
0.9.0-dev.1324+598db831f
Steps to Reproduce
I'm trying to save a PNG file with
stb_image_write
library:Expected Behavior
Expected it to successfully compile. As it does with
stbi_write_jpg
, for example.Actual Behavior
It fails with:
Looks like the issue is with line 829:
The text was updated successfully, but these errors were encountered: