Skip to content

BUG: Use signed char counter in RLEImage signed/unsigned test - #7239

Merged
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
domibel:rleimage-signed-char-counter
Nov 26, 2026
Merged

hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
domibel:rleimage-signed-char-counter

Conversation

@domibel

@domibel domibel commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

itkRLEImageTest fails on Linux arm64, riscv64 and other platforms where plain char is unsigned. Use signed char for the signed counter so the test behaves the same everywhere.

Plain `char` is unsigned on Linux arm64, riscv64, ...
@github-actions github-actions Bot added type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Filtering Issues affecting the Filtering module labels Nov 25, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing a pull request! 🙏

Welcome to the ITK community! 🤗👋☀️

We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. 📜
More support and guidance on the contribution process can be found in our contributing guide. 📖

This is an automatic message. Allow for time for the ITK community to be able to read the pull request and comment
on it.

@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Makes the signed-counter test independent of whether plain char is signed.

  • The RLE image test always uses a signed counter for its comparison.

No actionable issues found. Tests were not run.

Reviews (1) · Last reviewed commit: "BUG: Use signed char counter in RLEImage..." · Reviewed by Greptile

@hjmjohnson hjmjohnson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is the right fix: RLEImage::Allocate() throws when the x size exceeds std::numeric_limits<CounterType>::max(), so signed char gives 127 on every platform, and x86 behavior is unchanged. Nothing blocks merge.

Optional nits
  • The commit body trails off ("riscv64, ..."). Something like: "Plain char is unsigned on Linux arm64, ppc64le, and riscv64, so the counter accepts runs up to 255 and the xSize>127 exception test fails."
  • charRLEImage now names the signed char counter beside ucharRLEImage; scharRLEImage would read better (lines 49, 50, 55, 99).
  • The literal 127 at line 147 could be std::numeric_limits<signed char>::max(), so the threshold follows the type.
  • Related, not in scope: #7067, where Debug builds assert instead of throwing in Allocate(), so on arm64 Debug the 128-255 inputs now abort as they already do on x86.

@dzenanz dzenanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good as is. Hans' nits are optional.

@hjmjohnson
hjmjohnson merged commit fc82ba4 into InsightSoftwareConsortium:main Nov 26, 2026
16 of 18 checks passed
@domibel
domibel deleted the rleimage-signed-char-counter branch November 27, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Filtering Issues affecting the Filtering module type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants