View Issue Details

IDProjectCategoryView StatusLast Update
0031186RunnerWindows (YYC)Public2019-08-20 10:45
ReporterYellowAfterlifeAssigned ToRussell Kay 
PriorityLowSeverityC - GeneralReproducibility100%
Status ClosedResolutionNo Change Required 
PlatformWindowsOSWindows 10 ProOS Version>=18362
Product Version2.2.3 
Target VersionFixed in Version 
Summary0031186: YYC: -val is re-cast to YYRValue (regression?)
var a = 1, b;
b = -a;
b = a * -1;


local_b=YYRValue( -/* local */local_a.asReal() ); // <- this bit

local_b=(/* local */local_a * -1); // <- still fine

As a small bonus, third line is marked as line 4 for some reason.
Additional InformationAlso happens in green 2.2.3
TagsCompiler, yyc
1.4 Found In
2.x Runtime Found In9.9.1.1501
2.x Runtime Verified In



2019-07-16 12:37


yyc_negate_recast.yyz (59,773 bytes)

Russell Kay

2019-07-17 10:40

Manager   ~0064448

This is deliberate to match VM behaviour, unary -'ve only makes sense if the value can be converted into a number (which will generate an error if impossible) and then it is assigned as a YYRValue, this was part of the wider changes to get YYC behaviour and VM behaviour to match


2019-07-17 14:09

Developer   ~0064453

operator- already returns a byval YYRValue, so another cast should not be needed if we know that this is already an YYRValue (such as a local/instance var)?

Russell Kay

2019-08-16 15:02

Manager   ~0064565

It's not as simple as that as the asReal() part will convert it to a number first so the -'ve is taking place on a number (not an RValue) so the operator - is not called... it is converting it back to an RValue at that point.


2019-08-20 10:45

Adminstrator   ~0064595

Closing as per the above discussion ;)