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

type_int_unsigned_by_bitsize fails with illegal bitsize on arm64 #1649

Closed
radekm opened this issue Nov 29, 2024 · 4 comments
Closed

type_int_unsigned_by_bitsize fails with illegal bitsize on arm64 #1649

radekm opened this issue Nov 29, 2024 · 4 comments
Assignees
Milestone

Comments

@radekm
Copy link
Contributor

radekm commented Nov 29, 2024

Compiling this program c3c compile extern_test.c3 on macOS 15.0.1 on arm64

import std;

extern fn Features query_features() @extern("sg_query_features");

struct Features
{
    bool origin_top_left;
    bool image_clamp_to_border;
    bool mrt_independent_blend_state;
    bool mrt_independent_write_mask;
    bool storage_buffer;
}

fn void main()
{
    Features fs = query_features();
}

produces return code 1 and message

FATAL ERROR Illegal bitsize %d -> in type_int_unsigned_by_bitsize @ in /Users/runner/work/c3c/c3c/src/compiler/types.c:97 

Instead I would expect linker error because sg_query_features is currently not being linked.

c3c --version returns

C3 Compiler Version:       0.6.4
Installed directory:       *****
Git Hash:                  69004943a7de95c6b8bf21551d3627ceb6fa33f5
Backends:                  LLVM
LLVM version:              17.0.6
LLVM default target:       arm64-apple-darwin23.4.0
@lerno lerno self-assigned this Nov 29, 2024
@lerno lerno added Bug Something isn't working In Progress This task is currently being worked on labels Nov 29, 2024
@lerno
Copy link
Collaborator

lerno commented Nov 29, 2024

Yes, it's a bug. I'll fix it after work.

lerno added a commit that referenced this issue Nov 30, 2024
@lerno lerno added Fixed Needs Verification Fixed, but needs verification that it works and removed In Progress This task is currently being worked on labels Nov 30, 2024
@lerno
Copy link
Collaborator

lerno commented Nov 30, 2024

Thank you for that important bug report. It should be fixed now. Please give it a try!

@lerno lerno added this to the 0.6.5 milestone Nov 30, 2024
@radekm
Copy link
Contributor Author

radekm commented Nov 30, 2024

Thanks for the fix. It works on my machine with a custom build of c3c. Here's an output of c3c --version:

C3 Compiler Version:       0.6.5 (Pre-release, Nov 30 2024 12:35:54)
Installed directory:       *****
Git Hash:                  5fc6672784564d6b4e4db28ba7d37d15084c5528
Backends:                  LLVM
LLVM version:              19.1.3
LLVM default target:       arm64-apple-darwin24.1.0

@lerno
Copy link
Collaborator

lerno commented Nov 30, 2024

Great! Thank you for testing.

@lerno lerno closed this as completed Nov 30, 2024
@lerno lerno removed the Fixed Needs Verification Fixed, but needs verification that it works label Nov 30, 2024
@lerno lerno removed the Bug Something isn't working label Jan 21, 2025
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

No branches or pull requests

2 participants