Skip to content

fix(sv): read string characters as signed bytes - #2446

Merged
mergify[bot] merged 1 commit into
masterfrom
fix/sv-string-character-byte
Oct 28, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
fix/sv-string-character-byte

Conversation

@tignear

@tignear tignear commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

IEEE 1800-2023 6.16 makes a single character of a string variable a byte,
and 6.16.3 declares function byte getc(int i); 6.11 makes byte a signed
2-state type. Celox typed s[i] and s.getc(i) as unsigned 8-bit values, so a
character code above 127 converted to a positive integer. Type them as signed
bytes.

Impact: a character with code 128..255 now reads as a negative value when it
is widened, compared or printed as a number (int n = s[0] gives -1 for 8'hff,
s[0] < 0 is true, %0d prints -1). ASCII characters, putc, assignments of
characters to 8-bit variables and string contents are unchanged.

The shared string::characters_are_signed_bytes case checks the LRM values.
xezim 0.11.3 agrees; Verilator 5.052 and Icarus 13.0 read the code as 255.
The Verilator disagreement is retained with a standalone probe, and the case
joins Icarus' existing getc limitation. sv-tests conformance is unchanged.

IEEE 1800-2023 6.16 makes a single character of a string variable a `byte`,
and 6.16.3 declares `function byte getc(int i)`; 6.11 makes `byte` a signed
2-state type. Celox typed `s[i]` and `s.getc(i)` as unsigned 8-bit values, so a
character code above 127 converted to a positive integer. Type them as signed
bytes.

Impact: a character with code 128..255 now reads as a negative value when it
is widened, compared or printed as a number (`int n = s[0]` gives -1 for 8'hff,
`s[0] < 0` is true, `%0d` prints -1). ASCII characters, `putc`, assignments of
characters to 8-bit variables and string contents are unchanged.

The shared string::characters_are_signed_bytes case checks the LRM values.
xezim 0.11.3 agrees; Verilator 5.052 and Icarus 13.0 read the code as 255.
The Verilator disagreement is retained with a standalone probe, and the case
joins Icarus' existing getc limitation. sv-tests conformance is unchanged.

Change-Id: I394404abf48a74110753cecf60a1e35952fa5924
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-28T12:51:23.040069Z d377d75 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mergify

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 28, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 28, 2026
@mergify

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into master as fdfede0 at 15:09 UTC

Merged together with #2411, #2449. 1 h 15 min in the queue, 30 min of it CI.

So far

Merge conditions: 7 of 7 met

The batch, tested on draft #2452

Condition Required by
✅ check-success = Conventional Commit title —
✅ check-success = Queue validation —
✅ any of: check-success = @github-actions/Lint & Format, check-neutral = @github-actions/Lint & Format, check-skipped = @github-actions/Lint & Format GitHub repository ruleset rule master
✅ any of: check-success = @github-actions/Rust Test & NAPI Build, check-neutral = @github-actions/Rust Test & NAPI Build, check-skipped = @github-actions/Rust Test & NAPI Build GitHub repository ruleset rule master
✅ any of: check-success = @github-actions/JS Test (Ubuntu), check-neutral = @github-actions/JS Test (Ubuntu), check-skipped = @github-actions/JS Test (Ubuntu) GitHub repository ruleset rule master
✅ any of: check-success = @github-actions/Conventional Commit title, check-neutral = @github-actions/Conventional Commit title, check-skipped = @github-actions/Conventional Commit title GitHub repository ruleset rule master
✅ any of: check-success = @github-actions/Queue validation, check-neutral = @github-actions/Queue validation, check-skipped = @github-actions/Queue validation GitHub repository ruleset rule master

Times in UTC · dashboard · how the merge queue works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-ready Request merging through Mergify after required checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant