Reject Bedrock2 C outputs built for the wrong word size - #2399
Draft
JasonGross wants to merge 1 commit into
Draft
Conversation
JasonGross
force-pushed
the
codex/fix-2509-bedrock2-word-width
branch
from
September 2, 2026 04:09
7da00ff to
f1f7a3d
Compare
Collaborator
Author
|
The five platform-specific failures had the same cause: the checked-in Bedrock2 outputs contained one extra blank line before the new assertion compared with freshly generated output. The 31 artifacts now match the generator. GCC and Clang both compile the native-width corpus and reject the mismatched-width sample with the expected diagnostic. The Alpine failure was unrelated infrastructure trouble while
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rationale
Bedrock2 uses
uintptr_tfor both addresses and arithmetic words. Previously, compiling a_32.coutput for a 64-bit target made_br_loadand_br_storeaccess eight bytes while generated limb offsets advanced by four bytes. That caused overlapping limb accesses, a four-byte overrun at the end of caller buffers, and incorrect field arithmetic.The generator already receives the synthesis word size. This change preserves Bedrock2’s pointer-sized word model and turns any mismatch into a compile-time error before the affected code can run. The checked-in generated artifacts now reject both 32-on-64 and 64-on-32 mismatches. This addresses Scrutineer finding #2509.
Testing
opam exec -- make src/Bedrock/Field/Stringification/Stringification.vo EXTERNAL_DEPENDENCIES=1 -j2make -f Makefile.examples only-test-bedrock2-files CC=ccmake -f Makefile.examples only-test-bedrock2-files CC=clanggit diff --checkA genuine 32-bit compiler/sysroot was not available locally, so successful
_32.ccompilation on a 32-bit host was not executed. The generated assertion is symmetric, and its rejection path is covered on this 64-bit host.