Repository navigation
Commit a230b44
Core: Give bools C's rules: widen to 0 or 1, narrow by comparing with zero
A bool is ir.IntType(1), so convert() handled it as a 1-bit integer: a
bool slot's plain descriptor read as signed and True sign-extended to
-1 on the way out, and an integer narrowed to a bool by truncation, so
2 became false. Both predate this branch. C widens a bool to 0 or 1 and
narrows to it with != 0, and Python's truthiness agrees on the second.
signedness() now answers unsigned for any 1-bit integer whatever it is
wrapped in, convert() narrows to width 1 with icmp ne 0, and a bool
constant's slot carries the unsigned descriptor like the comparison
results already do.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>1 parent eaaa12e commit a230b44
3 files changed
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
0 commit comments