View Issue Details

IDProjectCategoryView StatusLast Update
0028780RunnerWindows (YYC)Public2019-05-13 17:18
ReporterStewart BishopAssigned ToRussell Kay 
PriorityLowSeverityC - GeneralReproducibility100%
Status ClosedResolutionFixed 
Product Version2.1.3 
Target Version2.2.1Fixed in Version2.2.1 
Summary0028780: Windows (YYC): Integer Promotion is different between VM and YYC
DescriptionThere is a consistency problem with integer promotion in VM vs YYC Windows builds. I've made a simple demonstration code below:

var a = 7;
var b = 4;
var c = 0.1;
var d = a & b; //using bitmath forces d to be int64
var e = c + d; //expect d to promote to float for addition
var f = d + c; //expect d to promote to float for addition
show_debug_message("a:" + string(a) + " is_real:" + string( is_real(a) ) );
show_debug_message("b:" + string(b) + " is_real:" + string( is_real(b) ) );
show_debug_message("c:" + string(c) + " is_real:" + string( is_real(c) ) );
show_debug_message("a&b = d:" + string(d) + " is_int64:" + string( is_int64(d) ) );
show_debug_message("c+d = e:" + string(e) + " is_int64:" + string( is_int64(e) ) + " is_real:" + string( is_real(e) ) );
show_debug_message("d+c = f:" + string(f) + " is_int64:" + string( is_int64(f) ) + " is_real:" + string( is_real(f) ) );

Windows
a:7 is_real:1
b:4 is_real:1
c:0.10 is_real:1
a&b = d:4 is_int64:1
c+d = e:4.10 is_int64:0 is_real:1
d+c = f:4.10 is_int64:0 is_real:1

Windows YYC
a:7 is_real:1
b:4 is_real:1
c:0.10 is_real:1
a&b = d:4 is_int64:1
c+d = e:4.10 is_int64:0 is_real:1
d+c = f:4 is_int64:1 is_real:0
Steps To Reproduce1) Run the sample on Windows
2) Run the sample on Windows YYC
3) See that the output differs
TagsCompiler, yyc
1.4 Found In1.4.1773
2.x Runtime Found In2.1.3.189
2.x Runtime Verified In2.1.3.189

Activities

Stewart Bishop

2018-01-29 11:59

Adminstrator  

Project1.gmz (8,916 bytes)

Russell Kay

2018-07-17 22:23

Manager   ~0060884

I have taken a look at this and the issue is that the rules for promotion in C++ and GML are different, I cannot change the C++ rules and I do not want to change the rules on GML at this time, I think this may be something that we will have to live with.

Unfortunately the devil is in the details between the 2 languages and we to try our best to get everything matching (while maintaining speed), I will not resolve this one yet to see if I can think of anything to work round the problem (unfortunately the types are not resolved to runtime so the compiler cannot really help in this situation).

Russell Kay

2018-07-17 22:47

Manager   ~0060885

Fixed in gitlab - I realised that it was not down to the C++ promotion rules but some logic in the operator+= function in YYGML.h this will make things slightly slower (and the function larger) but it fixes this discrepancy.