View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000108 | Ecere SDK | compiler | public | 2008-08-10 05:43 | 2013-09-30 09:05 |
Reporter | joey | Assigned To | jerome | ||
Priority | urgent | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Target Version | 0.44.10 64 | Fixed in Version | 0.44.10 64 | ||
Summary | 0000108: Consequential cast ignored; (char*)p + ((unsigned short)-page_free); subtracts instead of adds | ||||
Description | In the following code: void *p = (void*)0x12345678; unsigned short page_free = 65000; void *p2 = (char*)p + ((unsigned short)-page_free); printf("Use %p from %p\n", p2, p); The compiler ignores the cast to unsigned short, resulting in (char*)p + (-page_free), which turns into a subtraction. Compiling and running with eC produces this: Use 0x12335890 from 0x12345678 whereas compiling with GCC produces this: Use 0x12345890 from 0x12345678 The eC code posted above compiles into this (#line stuff removed): void * p = (void *)0x12345678; unsigned short page_free = (unsigned short)65000; void * p2 = (char *)p + (-page_free); printf("Use %p from %p\n", p2, p); | ||||
Additional Information | Trying to use casts in a printf call is problematic: byte a = 0x5B; printf("%x\n", (byte)~a); The (byte) cast is taken out by the eC compiler. | ||||
Tags | No tags attached. | ||||
|
First issue simplified as: unsigned short page_free = 65000; int a = (unsigned short)-page_free; |
|
Fixed by: https://github.com/ecere/ecere-sdk/commit/0deb55d8a3cf19b9b6960c24f076f723ea144667 |
Date Modified | Username | Field | Change |
---|---|---|---|
2008-08-10 05:43 | joey | New Issue | |
2010-09-20 04:25 | jerome | Priority | normal => urgent |
2010-09-20 04:25 | jerome | Severity | minor => major |
2010-09-20 04:25 | jerome | Target Version | => 0.44 pre-release 3 |
2010-09-20 04:25 | jerome | Additional Information Updated | |
2012-03-08 15:59 | redj | Target Version | old 0.44.pre3 => 0.45 Ginkakuji |
2012-03-29 07:50 | redj | Category | => eC Compiling Tools |
2012-03-29 07:50 | redj | Project | @2@ => Ecere SDK |
2013-09-23 06:47 | jerome | Note Added: 0001078 | |
2013-09-23 07:08 | jerome | Assigned To | => jerome |
2013-09-23 07:08 | jerome | Status | new => assigned |
2013-09-23 07:08 | jerome | Target Version | 0.45 Ginkakuji => 0.44.10 64 |
2013-09-30 09:05 | jerome | Status | assigned => closed |
2013-09-30 09:05 | jerome | Note Added: 0001106 | |
2013-09-30 09:05 | jerome | Resolution | open => fixed |
2013-09-30 09:05 | jerome | Fixed in Version | => 0.44.10 64 |
2014-05-27 07:01 | jerome | Relationship added | related to 0000205 |