2018-04-14 12:42 GMT+02:00 Punit Agrawal <punitagra...@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 begin 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.) Regards, Michalis