View Issue Details

IDProjectCategoryView StatusLast Update
0000205Ecere SDKcompilerpublic2014-08-08 18:17
Reporterjerome Assigned Tojerome  
PriorityimmediateSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Target Version0.44.10 64Fixed in Version0.44.10 64 
Summary0000205: Fix integer promotions to follow the C standard (6.3.1.1)
DescriptionC integer promotions (6.3.1.1) says that operator expressions will result in either an int if it can represent all values of the original type otherwise a uint. eC currently only promotes between operand types.

char a,b; bool overflow = ((a^b>=0)&&((char)((char)(a+b)^a)<0));

This is about the disappearance of the (char) cast of the result of the second ^ operator:

(char)((a+b)^a)

char a = 120, b = 100;
bool overflow1 = ((a^b >=0) && ((char)((char)(a+b)^a)<0));
bool overflow2 = ((a^b >=0) && ((char)(int)((char)(a+b)^a)<0));

eC thinks the result of a char ^ char is a char, and thus the cast is superfluous, but that is not in agreement with the C standard.

TagsNo tags attached.

Relationships

related to 0000108 closedjerome Consequential cast ignored; (char*)p + ((unsigned short)-page_free); subtracts instead of adds 

Activities

jerome

2014-05-27 06:58

administrator   ~0001323

Last edited: 2014-05-27 08:11

I think the essence of what needs to be done, in both ProcessExpressionType and ComputeExpression is first converting char and short to int (or uint if unsigned) for both operands.

Correct left and right shift, it probably should not set useSideType, should always use left operand type, so that:

' ' << 1L

is an int.

jerome

2014-07-07 06:02

administrator   ~0001357

Fixed by:
https://github.com/ecere/ecere-sdk/commit/3f3c5e72d6b5e4bcd1f6e5a57ce2a5e18bb30663

jerome

2014-07-07 09:33

administrator   ~0001358

Corrected by:
https://github.com/ecere/ecere-sdk/commit/d50f2422c7dd5a2f34d992bb37dca659f90fa49b

Issue History

Date Modified Username Field Change
2009-05-03 06:16 jerome New Issue
2012-03-08 16:51 redj Target Version => 0.45 Ginkakuji
2012-03-29 07:50 redj Category => eC Compiling Tools
2012-03-29 07:50 redj Project @2@ => Ecere SDK
2014-05-27 01:51 jerome Description Updated
2014-05-27 02:19 jerome Description Updated
2014-05-27 02:20 jerome Description Updated
2014-05-27 03:16 jerome Target Version 0.45 Ginkakuji => 0.46 eC II
2014-05-27 03:16 jerome Summary char a,b; bool overflow = ((a^b>=0)&&((char)((char)(a+b)^a)<0)); => Fix integer promotions to follow the C standard (6.3.1.1)
2014-05-27 03:16 jerome Description Updated
2014-05-27 03:54 jerome Description Updated
2014-05-27 03:55 jerome Description Updated
2014-05-27 03:56 jerome Priority normal => high
2014-05-27 04:12 jerome Severity minor => major
2014-05-27 04:12 jerome Reproducibility have not tried => always
2014-05-27 06:00 jerome Assigned To => jerome
2014-05-27 06:00 jerome Status new => assigned
2014-05-27 06:00 jerome Target Version 0.46 eC II => 0.44.10 64
2014-05-27 06:58 jerome Note Added: 0001323
2014-05-27 07:01 jerome Relationship added related to 0000108
2014-05-27 08:11 jerome Note Edited: 0001323
2014-07-06 23:26 jerome Priority high => immediate
2014-07-07 06:02 jerome Note Added: 0001357
2014-07-07 06:02 jerome Status assigned => resolved
2014-07-07 06:02 jerome Fixed in Version => 0.44.10 64
2014-07-07 06:02 jerome Resolution open => fixed
2014-07-07 09:33 jerome Note Added: 0001358
2014-08-08 18:17 jerome Status resolved => closed