Skip to content

issue #241: add infrastructure for range checking#296

Open
seanm wants to merge 2 commits into
tbeu:masterfrom
seanm:issue241-try2
Open

issue #241: add infrastructure for range checking#296
seanm wants to merge 2 commits into
tbeu:masterfrom
seanm:issue241-try2

Conversation

@seanm

@seanm seanm commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@seanm

seanm commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

@tbeu I still need to fill out all the variants of the conversion functions, but any thoughts on this general approach?

@seanm

seanm commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

@tbeu I still need to fill out all the variants of the conversion functions, but any thoughts on this general approach?

@tbeu friendly ping

@tbeu tbeu force-pushed the issue241-try2 branch from e883884 to 5df3925 Compare May 16, 2026 18:01
@tbeu tbeu linked an issue May 18, 2026 that may be closed by this pull request
@tbeu

tbeu commented May 18, 2026

Copy link
Copy Markdown
Owner

CI is failing. This needs to be addressed.

@seanm

seanm commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

CI is failing. This needs to be addressed.

That's expected. This is WIP. I'd like to know if you find the general approach acceptable before I spend more time to finish it off.

@tbeu

tbeu commented May 20, 2026

Copy link
Copy Markdown
Owner

So well, if it works and solves the issue...

@seanm

seanm commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

So well, if it works and solves the issue...

OK I'll finish it off then...

@seanm seanm force-pushed the issue241-try2 branch 2 times, most recently from 8726eab to 2c6094d Compare May 20, 2026 15:57
@seanm seanm changed the title WIP: issue #241: range checking issue #241: add infrastructure for range checking May 20, 2026
@seanm

seanm commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@tbeu ok I've decided to split this into 2 PRs since there's 1 test failing that needs investigation.

So for now, this first PR only adds the the infrastructure to eventually fix the UB conversions. It should change no behaviour. It's ready for review and merging.

Modified READ_DATA macro to:

- know both source and destination type
- provide a function to convert between types

For now the conversion function just casts, which is what the macro did before. In other words, this commit should not change any behaviour at all. It only adds infrastructure.

Subsequently we can carefully implement the conversion functions to not invoke undefined behaviour when converting, for example, large ints to small ints.
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.

READ_DATA macro needs checks before float to int casts

2 participants