Bart <bartjun...@gmail.com> schrieb am Fr., 27. Apr. 2018, 13:42: > On Wed, Apr 25, 2018 at 11:04 AM, <i...@wolfgang-ehrhardt.de> wrote: > > > If you compile and run this 64-bit program on Win 64 you get a crash > > And AFAICS your analysis of the cause (see bugtracker) is correct as well. > > function fpc_frac_real(d: ValReal) : ValReal;compilerproc; assembler; > nostackframe; > asm > cvttsd2si %xmm0,%rax > { Windows defines %xmm4 and %xmm5 as first non-parameter volatile > registers; > on SYSV systems all are considered as such, so use %xmm4 } > cvtsi2sd %rax,%xmm4 > subsd %xmm4,%xmm0 > end; > > CVTTSD2SI — Convert with Truncation Scalar Double-Precision > Floating-Point Value to Signed Integer > This should not be used to get a ValReal result. >
The code essentially does the following (instruction by instruction): === code begin === tmpi := int64(d - trunc(d)); tmpd := double(tmpi); Result := d - tmpd; === code end === Though why it fails with the given value is a different topic... Regards, Sven >
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel