Skip to content

Mark char as signed in the aarch64-apple-darwin machine model - #5251

Open
calef wants to merge 1 commit into
model-checking:mainfrom
calef:aarch64-darwin-signed-char
Open

calef wants to merge 1 commit into
model-checking:mainfrom
calef:aarch64-darwin-signed-char

Conversation

@calef

@calef calef commented Dec 4, 2026

Copy link
Copy Markdown

Based on main, independent of #4913. It merges cleanly with it.

The AArch64 machine model sets char_is_unsigned for every OS. That is right on Linux, but char is signed on Apple arm64: see Apple's "Writing ARM64 code for Apple platforms", core::ffi::c_char on aarch64-apple-darwin, and CBMC's own macOS arm64 configuration.

Host runs on macOS hide this today, because goto-cc compiles kani_lib.c with the host's configuration during the link and replaces the symbol Kani wrote. It still reaches the C char type kani-compiler gives string constants. Once #4913 keeps Kani's written model in the linked binary for a non-host --target, --target aarch64-apple-darwin from another host would check C code with unsigned char.

char_is_unsigned now depends on the OS, as wchar_t_is_unsigned already does. The table is split out of new_machine_model so a unit test can check it without a rustc session.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

🤖 Generated with Claude Code

https://claude.ai/code/session_01M1dgc2zy347cbi6td1Wd4x

The AArch64 model set char_is_unsigned for every OS. That holds on Linux,
but char is signed on Apple arm64 (Apple's "Writing ARM64 code for Apple
platforms", core::ffi::c_char on aarch64-apple-darwin, and CBMC's own
macOS arm64 configuration). Host runs on macOS hide this today, because
goto-cc compiles kani_lib.c with the host's configuration during the
link and replaces the symbol Kani wrote. It still reaches the C char type
kani-compiler gives string constants, and any change that keeps Kani's
written model in the linked binary would expose it.

Make it depend on the OS, as wchar_t_is_unsigned already does, and split
the table out of new_machine_model so a unit test can check it without a
rustc session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M1dgc2zy347cbi6td1Wd4x

This branch has not been deployed

No deployments
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.

1 participant