On Tue, 27 Feb 2018 18:56:10 -0500 "Aaron M. Ucko" <[email protected]> wrote: > Source: castle-game-engine > Version: 6.4+dfsg1-2 > Severity: important > Tags: upstream > Justification: fails to build from source > User: [email protected] > Usertags: arm64 > > Builds of castle-game-engine for arm64 have been failing. As of the > latest upload (6.4+dfsg1-2), it ran into an assortment of test suite > errors and failures, per the below excerpts from [1]. Could you > please take a look?
There are a few different errors/failures in the log. I started out by
looking into -
> List of failures:
> Failure:
> Message: TTestRectangles.TestScaleEmpty: expected: <0> but
> was: <429496729600>
> Exception class: EAssertionFailedError
> Exception message: expected: <0> but was: <429496729600>
> at $00000000004C57C4
After some trial and error, I landed on the first failing statement in
TestScaleEmpty.
AssertEquals(0, R.ScaleAround0(2).Width);
where R is a Rectangle(10, 20, 0, 50), i.e., Width = 0 and Height = 50.
ScaleAround0() returns a record of type TRectangle.
function TRectangle.ScaleAround0(const Factor: Single): TRectangle;
var
ResultRight, ResultTop: Integer;
begin
if Width > 0 then
begin
Result.Left := Floor(Left * Factor);
ResultRight := Ceil(Right * Factor);
Result.Width := ResultRight - Result.Left;
end else
begin
Result.Width := Width;
Result.Left := Left;
end;
if Height > 0 then
begin
Result.Bottom := Floor(Bottom * Factor);
ResultTop := Ceil(Top * Factor);
Result.Height := ResultTop - Result.Bottom;
end else
begin
Result.Height := Height;
Result.Bottom := Bottom;
end;
end;
After parsing the function, the AssertEquals() makes sense.
At this point, I suspect it's a compiler issue. I've created a
reproducer (attached) that highlights the problem and behaves
differently on arm64 and x86.
Note: I am not at all familiar with Pascal. Input from somebody more
familiar with the language ecosystem will be greatly appreciated.
test.pas
Description: Binary data

