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

C backend produces incomplete source code for calls to functions with large integer parameters #19991

Open
amp-59 opened this issue May 17, 2024 · 0 comments
Labels
backend-c The C backend (CBE) outputs C source code. bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@amp-59
Copy link
Contributor

amp-59 commented May 17, 2024

Zig Version

0.13.0-dev.211+6a65561e3

Steps to Reproduce and Observed Behaviour

Test example program with zig test -ofmt=c cbe_nextafter_error.zig
cbe_nextafter_error.zig:

fn f2(_: u129) void {}
fn f1(data: struct { x: u128 }) void {
    f2(data.x);
}
export fn entry() void {
    f1(.{ .x = 0 });
}
test {
    entry();
}

Output:

zig test -ofmt=c cbe_nextafter_error.zig
~/.local/share/test/zig-cache/o/19d550fa7f176a5ec3f23371e9ffc1d4/test.c:8214:7: error: call to undeclared function 'zig_make_big'; ISO C99 and later do not support implicit function declarations
 t1 = zig_make_big(zig_hi_u128(t0), zig_lo_u128(t0));
      ^
~/.local/share/test/zig-cache/o/19d550fa7f176a5ec3f23371e9ffc1d4/test.c:8214:5: error: array type 'zig_u128[2]' (aka 'unsigned __int128[2]') is not assignable
 t1 = zig_make_big(zig_hi_u128(t0), zig_lo_u128(t0));
 ~~~^
error: the following test command failed with exit code 1:
~/.local/src/zig-linux-x86_64-0.13.0-dev.211+6a65561e3/zig run -I ~/.local/src/zig-linux-x86_64-0.13.0-dev.211+6a65561e3/lib ~/.local/share/test/zig-cache/o/19d550fa7f176a5ec3f23371e9ffc1d4/test.c
@Vexu Vexu added bug Observed behavior contradicts documented or intended behavior backend-c The C backend (CBE) outputs C source code. labels May 18, 2024
@Vexu Vexu added this to the 0.13.0 milestone May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend-c The C backend (CBE) outputs C source code. bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

2 participants