[Pkg-pascal-devel] Bug#891682: castle-game-engine: FTBFS on arm64: assorted test suite errors and failures

Michalis Kamburelis michalis.kambi at gmail.com
Sat Apr 14 13:56:05 BST 2018

 2018-04-14 12:42 GMT+02:00 Punit Agrawal <punitagrawal at gmail.com>:
> 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.

Great job!

Note that in your testcase, the minimized "TRectangle.ScaleAround0"
does not set Result.Width, Result.Left in some cases. And, since this
is a record, the uninitialized fields are undefined (may contain
memory garbage).

It should not matter for the result (from what I see, the
TRectangle.Width is always guaranteed to be 0 when calling this). But
maybe writing something like

   if Width <= 0 then
      Result.Width  := Width;
      Result.Left   := Left;
   end else
      Writeln('This should never happen');

would make this clearer?

The testcase definitely makes sense to me, and if you get different
results on different CPUs -- then indeed we have nicely reproducible
FPC bug.

(P.S. I'm the castle-game-engine upstream author.)

More information about the Pkg-pascal-devel mailing list