Fix and test signed/unsigned comparison semantics
Open
- Dominant language
- Python
- Stars
- 636
- Forks
- 81
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 7
Description
There's the classical C footgun:
```c
int x = -1;
unsigned int y = 1;
if (x < y) { ... } // branch NOT taken — x converts to UINT_MAX
```
We're currently subject to this behavior, which isn't consistent with Python semantics (which we otherwise try to follow). Tweak `map_comparison` in `ExpressionToCExpressionMapper` in `loopy/target/c/codegen/expression.py` to treat mixed-signedness comparisons correctly. Add exhaustive tests. Also cover mixed-signedness subtraction.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.