Skip to content

C backend fixes#13093

Merged
andrewrk merged 48 commits intoziglang:masterfrom
jacobly0:backend-fixes
Oct 30, 2022
Merged

C backend fixes#13093
andrewrk merged 48 commits intoziglang:masterfrom
jacobly0:backend-fixes

Conversation

@jacobly0
Copy link
Copy Markdown
Member

@jacobly0 jacobly0 commented Oct 7, 2022

This enabled all of the behavior tests for the C backend that were passing and fixed all of the C warnings from the flags -Wextra -Wall -pedantic for the behavior tests except various unused (but set) and uninitalized (only with safety off) warnings, and then fixes a bunch of disabled behavior tests.

Some notable C backend milestones achieved with these changes:

  • The C backend is now passing 90% (1243/1374) of the behavior tests vs the LLVM backend.
  • The official hello world now works on at least x86_64-linux (with and without libc).
  • The test runner now prints output to the console.

Fixes #12751
Fixes #11651

@jacobly0 jacobly0 force-pushed the backend-fixes branch 3 times, most recently from bd2b4ef to 0a898b5 Compare October 10, 2022 09:52
@Luukdegram
Copy link
Copy Markdown
Contributor

I know this PR is still in draft, but could you extract 1cc6a95 into its own PR? It will make this and the new PR easier to review and we can merge the fixes separately from the C backend improvements. Especially as the fix contains changes to all of the native backends also, which was quite easy to miss from the title and description of this PR.

@jacobly0 jacobly0 changed the title C and LLVM backend fixes C backend fixes Oct 11, 2022
@andrewrk
Copy link
Copy Markdown
Member

Looking forward to this!

@jacobly0 jacobly0 force-pushed the backend-fixes branch 6 times, most recently from 329f3c9 to d13bfb0 Compare October 20, 2022 15:46
@andrewrk
Copy link
Copy Markdown
Member

andrewrk commented Oct 23, 2022

std: add cbe hacks to more targets

Interesting 🤔

I'm going to look into enhancing the lowering of inline assembly, so that it can automatically do these transforms (e.g. turning "{x8}" to "{i}" and inserting a "mov" when inside a naked function body). In the meantime, these hacks are nice workarounds 👍

@andrewrk
Copy link
Copy Markdown
Member

Related: #13278

@jacobly0 jacobly0 force-pushed the backend-fixes branch 2 times, most recently from 238d94d to 1b80daa Compare October 24, 2022 19:32
@andrewrk
Copy link
Copy Markdown
Member

Is this still intentionally a draft, or are you perhaps looking for review & merge now?

@jacobly0 jacobly0 marked this pull request as ready for review October 29, 2022 20:23
@jacobly0
Copy link
Copy Markdown
Member Author

This is in as good a state as any to review and merge. I can always open a new PR with further fixes.

Copy link
Copy Markdown
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incredible work. This is ready to be merged.

@andrewrk andrewrk merged commit 5f5a20e into ziglang:master Oct 30, 2022
@jacobly0 jacobly0 deleted the backend-fixes branch October 30, 2022 03:15
TUSF pushed a commit to TUSF/zig that referenced this pull request May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Naming mangling issue C backend on behavior tests emits C code with compile errors when using -std=c99 -Werror -pedantic

3 participants