View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0000158 | mercury | Bug | public | 2010-08-18 14:31 | 2010-08-19 17:36 | ||||
Reporter | colanderman | ||||||||
Assigned To | wangp | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0000158: char constants do not unify | ||||||||
Description | For some reason, this code: if det_from_int(255) = '\xFF\' then print("succeed\n", !IO) else print("fail\n", !IO) prints "fail". This code however: if 255 = to_int('\xFF\') then print("succeed\n", !IO) else print("fail\n", !IO) prints "succeed" as expected. | ||||||||
Additional Information | Mercury 10.04, Debian Linux 32-bit | ||||||||
Tags | No tags attached. | ||||||||
Attached Files |
|
Notes | |
wangp (developer) 2010-08-18 15:32 |
Thanks. This bug affects 8-bit character literals in low-level C grades. The LLDS doesn't differentiate between integer and character constants, and the 0xff character ends up in the C source code as (MR_Integer)255 instead of (MR_Char)255. MR_Char is signed (depends on the compiler) so we end up comparing 255 with -1. |
Issue History | |||
Date Modified | Username | Field | Change |
---|---|---|---|
2010-08-18 14:31 | colanderman | New Issue | |
2010-08-18 14:31 | colanderman | File Added: charbug.m | |
2010-08-18 15:32 | wangp | Note Added: 0000279 | |
2010-08-19 17:36 | wangp | Status | new => resolved |
2010-08-19 17:36 | wangp | Resolution | open => fixed |
2010-08-19 17:36 | wangp | Assigned To | => wangp |