Skip to content

Comparisons with constants as values in signed_compare.c, both outcomes in enums.c - #96

Merged
skerkewitz-agent[bot] merged 1 commit into
developfrom
signed-compare-value-tests
Nov 29, 2026
Merged

skerkewitz-agent[bot] merged 1 commit into
developfrom
signed-compare-value-tests

Conversation

@skerkewitz-agent

Copy link
Copy Markdown
Contributor

What

Closes the gap in the tests that let the miscompile fixed in #94 through. This commit was meant for #94 but reached GitHub after #94 was merged.

Verified

What follows

  • Generated code: only the recorded output of the two tests in backend-output.txt. The compiler is unchanged.
  • C guide, StyleGuideTest, the game, documents, book: unchanged.

🤖 Generated with Claude Code

…es in enums.c

signed_compare.c tested the comparisons as values only between two
variables, and against constants only as branches: the case the value form
got wrong was not in it. It now takes all four relations as values against
constants, of any 16-bit value and of a difference of bytes (no overflow
possible), and fails without the previous commit's fix. That showed the
bug was wider: x < 0 and x >= 0 as values gave 1 for every 16-bit x.

enums.c ran each comparison on one input, and its true result was the one
the broken code always gave. Each comparison now also runs on an input
that makes it false.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@skerkewitz-agent
skerkewitz-agent Bot merged commit 31c190f into develop Nov 29, 2026
1 check passed
@skerkewitz-agent
skerkewitz-agent Bot deleted the signed-compare-value-tests branch November 29, 2026 22:07
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