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 test regression of array alignment after LLVM 14 upgrade #12055

Closed
andrewrk opened this issue Jul 9, 2022 · 2 comments
Closed

translate-c test regression of array alignment after LLVM 14 upgrade #12055

andrewrk opened this issue Jul 9, 2022 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior regression It worked in a previous version of Zig, but stopped working. stage1 The process of building from source via WebAssembly and the C backend. translate-c C to Zig source translation feature (@cImport)
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Jul 9, 2022

No idea why this is happening. Observed to happen on the FreeBSD CI and AArch64 Drone CI, after the LLVM 14 upgrade.

========= Expected to find: ===================
pub extern var my_array: [16]u8 align(128);
pub export fn my_fn() align(128) void {}
pub export fn other_fn() void {
    var ARR: [16]u8 align(16) = undefined;
    _ = ARR;
}
========= But file does not contain it: =======
pub extern var my_array: [16]u8;
pub export fn my_fn() align(128) void {}
pub export fn other_fn() void {
    var ARR: [16]u8 = undefined;
    _ = ARR;
}

Happens with stage1; have not confirmed whether it happens with stage2 or stage3 yet (could make a difference due to LLVM IR C ABI lowerings)

@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior os-freebsd stage1 The process of building from source via WebAssembly and the C backend. translate-c C to Zig source translation feature (@cImport) regression It worked in a previous version of Zig, but stopped working. labels Jul 9, 2022
@andrewrk andrewrk added this to the 0.10.0 milestone Jul 9, 2022
@andrewrk andrewrk changed the title translate-c test regression of array alignment translate-c test regression of array alignment after LLVM 14 upgrade Jul 9, 2022
@ehaas
Copy link
Contributor

ehaas commented Jul 11, 2022

This does not happen on MacOS when using translate-c with -target aarch64-linux-musl (or with a freebsd target). So it seems to be something specifically about running on those platforms (I'd be curious if it fails with -target x86_64-macos-none when running on FreeBSD or aarch64-linux-musl). From a quick glance at the code I don't see why FunctionDecl's would work but VarDecl's wouldn't.

@andrewrk
Copy link
Member Author

I can reproduce this with a zig-bootstrap build of x86_64-linux-musl - even the host build. Perhaps the next thing to check would be if the problem happens with a debug build.

wooster0 pushed a commit to wooster0/zig that referenced this issue Jul 24, 2022
@andrewrk andrewrk modified the milestones: 0.10.0, 0.10.1 Oct 12, 2022
@andrewrk andrewrk modified the milestones: 0.10.1, 0.11.0 Jan 10, 2023
@Vexu Vexu modified the milestones: 0.11.0, 0.12.0 Apr 23, 2023
Vexu added a commit to Vexu/zig that referenced this issue Mar 28, 2024
Vexu added a commit to Vexu/zig that referenced this issue Mar 28, 2024
Vexu added a commit to Vexu/zig that referenced this issue Mar 28, 2024
Vexu added a commit to Vexu/zig that referenced this issue Mar 28, 2024
@andrewrk andrewrk modified the milestones: 0.14.0, 0.12.0 Mar 28, 2024
Rexicon226 pushed a commit to Rexicon226/zig that referenced this issue Mar 29, 2024
TUSF pushed a commit to TUSF/zig that referenced this issue May 9, 2024
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 regression It worked in a previous version of Zig, but stopped working. stage1 The process of building from source via WebAssembly and the C backend. translate-c C to Zig source translation feature (@cImport)
Projects
None yet
Development

No branches or pull requests

3 participants