Skip to content

c-backend: generating undeclared functions for zig.h #23257

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

Closed
bnuuydev opened this issue Mar 15, 2025 · 1 comment
Closed

c-backend: generating undeclared functions for zig.h #23257

bnuuydev opened this issue Mar 15, 2025 · 1 comment
Labels
backend-c The C backend (CBE) outputs C source code. bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@bnuuydev
Copy link

Zig Version

0.15.0-dev.62+ea57fb55e

Steps to Reproduce and Observed Behavior

The C backend can be made to emit undeclared functions for the big type. This example shows this behaviour:

const std = @import("std");

pub fn main() void {
    std.debug.print("{}", .{@as(u256, 0)});
}

Functions such as zig_make_big and zig_lo_big are being emitted. These functions aren't, and as far as I can tell shouldn't be, defined in zig.h. Consequently, when this code is run using zig run test.zig -ofmt=c, it produces a load of errors, and doesn't run.

Expected Behavior

It looks like the issue is not that zig_make_big and zig_lo_big are undefined, it is that the c-backend is emitting these calls when it shouldn't be. The expected behaviour is obviously for this code to run without error.

@bnuuydev bnuuydev added the bug Observed behavior contradicts documented or intended behavior label Mar 15, 2025
@alexrp alexrp added the backend-c The C backend (CBE) outputs C source code. label Mar 15, 2025
@alexrp alexrp added this to the 0.15.0 milestone Mar 15, 2025
@bnuuydev
Copy link
Author

Sorry, this actually looks like a duplicate of #19991

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