Repository navigation
[AUTOMATED] Define fixed signed ARM shifts in emitted C - #1013
Merged
Merged
Conversation
…constshift) The conversion makes the shift defined C, but it rewrites the sign-bit test firmware uses for nearly every register flag check: `x << 0x18 < 0` becomes `(int)((unsigned int)x << 0x18) < 0`. On three libopencm3 examples it changed 11 functions, each only by that cast pair. Keep the shorter spelling by default and make the defined form an explicit per-run choice: - New P9 option `armconstshift` (default off, not in the aggressive preset). - The stage test is two-pass: off keeps the shift as written, on pins the casts. - The CLI round-trip test opts in; the interwork and soft-float expectations return to main's text. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011d7uHgQPRpFwdybmGwWHtw
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011d7uHgQPRpFwdybmGwWHtw
Contributor
|
[AUTOMATED] Merged with one change on top (39fb862): the conversion now runs only under the new option Firmware tests nearly every register flag with a sign-bit shift, so by default it rewrote |
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.
A fixed ARM
LSL #2on a signed parameter emits a C11 shift that is undefined for negative values and positive overflow. Converting the result afterward does not help:The unpatched output is:
Fix
Tests
arm_constant_shift::passes. Its authored probes compile and run the emitted C with GCC and Clang at-O0and-O2, including UBSan.