Wrong values passed to a procedure if a calculation is used in the call FPC 3.3.1 , 3.2.2 , 3.2.0 on ARM Linux Raspberry Pi
Hi all. I have a strange issue that I am not sure what is going on. I use FPC / Lazarus mainly on Raspberry Pi ARM Linux. I got a new 8GB pi and installed Trunk FPC and Trunk Lazarus. I then installed the BGRA Controls and found that the controls did not behave correctly. I logged an issue with the developer and after a lot of testing he said it seems to be a FPC issue on ARM Linux.
Here is the link to the issue.
https://github.com/bgrabitmap/bgracontrols/issues/113
I wrote some test code and found that the values being sent from the calling procedure does not end up correctly on the called procedure side if you use a calculation inside the procedure call. If I create new variables and do the calculation first and then use the variables inside the procedure call then all works fine.
I found the same issue now with different version of FPC also not only the 3.3.1 version. 3.2.2, 3.2.0 also does this.
Here is a sort code extract from the control code. I print the values before the call
writeln('Width : ' + floattostr(Width));
writeln('Height : ' + floattostr(Height));
writeln('Half Width : ' + floattostr(Width / 2));
writeln('Half Height : ' + floattostr(Height / 2));
FBitmap.Canvas2D.arc(Width / 2, Height / 2, Height / 2.5, 0, pi * 2, False);
As you can see there are calculations inside the call like Height / 2
Then on the receiving procedure side I print what is the values of X and Y as passed in.
procedure TBGRACanvas2D.arc(x, y, radius, startAngleRadCW, endAngleRadCW: single;
anticlockwise: boolean);
var pts: array of TPointF;
temp: single;
pt: TPointF;
rx,ry: single;
len1,len2: single;
unitAffine: TAffineMatrix;
v1orig,v2orig,v1ortho,v2ortho: TPointF;
startRadCCW,endRadCCW: single;
begin
writeln('X in arc : ' + floattostr(x));
writeln('Y in arc : ' + floattostr(y));
v1orig := PointF(currentState.matrix[1,1],currentState.matrix[2,1]);
v2orig := PointF(currentState.matrix[1,2],currentState.matrix[2,2]);
And here is the output. Y should be 100, yet it is 3.390625
Width : 200
Height : 200
Half Width : 100
Half Height : 100
X in arc : 100
Y in arc : 3.390625
is there some setting or switch that should be set so that this does not happen on FPC?