FPC 3.3.1 Error 216 General Protection fault for abs with GO32V2 / SSE2 lazarus / 64-FPC development ---------------------------------------------------------------------- Gammatester · 2018-12-01 19:48 There is a problem with the abs function for FPC3.3.1/GO32V2 when using SSE2. FPC was installed from go32v2-fpc-3.3.1.x86_64-linux.tar.gz. The following program Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program t_abssse;var  x: double;begin  writeln('Abs bug with SSE/GO32V2');  x := -1;  writeln('x=',x);  writeln('sin(x)=',sin(x));  writeln('abs(x)=',abs(x));end. works as expected under Window XP and Windows 8 without SSE and throws a runtime error 216 when compiled with  -CfSSE2.  Should this be reported as an issue in the bugtracker? Code: [Select]Windows XP D:\FPC331D\bin\go32v2>fpc Free Pascal Compiler version 3.3.1-r20:40421 [2018/11/30] for i386 Copyright (c) 1993-2018 by Florian Klaempfl and others D:\FPC331D\bin\go32v2>ver Microsoft Windows XP [Version 5.1.2600] D:\FPC331D\bin\go32v2>fpc.exe t_abssse.pas D:\FPC331D\bin\go32v2>t_abssse.exe Abs bug with SSE/GO32V2 x=-1.0000000000000000E+000 sin(x)=-8.41470984807896506665E-0001 abs(x)= 1.0000000000000000E+000 D:\FPC331D\bin\go32v2>fpc -CfSSE2 t_abssse.pas D:\FPC331D\bin\go32v2>t_abssse.exe Abs bug with SSE/GO32V2 x=-1.0000000000000000E+000 sin(x)=-8.41470984807896506665E-0001 Runtime error 216 at $000018B2   $000018B2   $00001795 abs(x)= D:\FPC331D\bin\go32v2> Windows 8 C:\FPC331D\bin\go32v2>fpc.exe Free Pascal Compiler version 3.3.1-r20:40421 [2018/11/30] for i386 Copyright (c) 1993-2018 by Florian Klaempfl and others C:\FPC331D\bin\go32v2>ver Microsoft Windows [Version 6.2.8400] C:\FPC331D\bin\go32v2>fpc t_abssse.pas C:\FPC331D\bin\go32v2>t_abssse.exe Abs bug with SSE/GO32V2 x=-1.0000000000000000E+000 sin(x)=-8.41470984807896506665E-0001 abs(x)= 1.0000000000000000E+000 C:\FPC331D\bin\go32v2>fpc -CfSSE2 t_abssse.pas C:\FPC331D\bin\go32v2>t_abssse.exe Abs bug with SSE/GO32V2 x=-1.0000000000000000E+000 sin(x)=-8.41470984807896506665E-0001 Runtime error 216 at $000018B2   $000018B2   $00001795 abs(x)= C:\FPC331D\bin\go32v2> ---------------------------------------------------------------------- lucamar · 2018-12-01 20:32 Have you tried in an actual DOS box? It may be a strange interaction between the extender and the OS treatment of the FPU. ---------------------------------------------------------------------- Gammatester · 2018-12-01 21:06 Quote from: lucamar on December 01, 2018, 09:32:42 pmHave you tried in an actual DOS box? It may be a strange interaction between the extender and the OS treatment of the FPU. This makes no difference, here the results for Windows 98 and DOSBox (the first runs are without SSE the second with SSE): Code: [Select]C:\TMP>ver Windows 98 [Version 4.10.1998] C:\TMP>t_abs.exe Abs bug with SSE/GO32V2 x=-1.0000000000000000E+000 sin(x)=-8.41470984807896506665E-0001 abs(x)= 1.0000000000000000E+000 C:\TMP>T_ABSSSE.EXE Abs bug with SSE/GO32V2 x=-1.0000000000000000E+000 sin(x)=-8.41470984807896506665E-0001 Runtime error 216 at $000018B2   $000018B2   $00001795 abs(x)= C:\TMP> DOSBox version 0.74-2. Reported DOS version 5.00. Abs bug with SSE/GO32V2 x=-1.0000000000000000E+000 sin(x)=-8.41470984807896506665E-0001 abs(x)= 1.0000000000000000E+000 Abs bug with SSE/GO32V2 x=-1.0000000000000000E+000 sin(x)=-8.41470984807896506665E-0001 abs(x)= Error and error addr only displayed on screen, could not be redirected with DOSBox ---------------------------------------------------------------------- lucamar · 2018-12-01 21:58 Sorry, by "DOS box" I meant a computer with a real DOS (as in MS-DOS, DR-DOS, FreeDOS, ...) in it, not the emulator But Windows 98 (boot-up with no GUI, I hope?) is enough test. I kinfd of remember there was some problem with the FPU control word but I haven't been able to find the reference, sorry again. ---------------------------------------------------------------------- Gammatester · 2018-12-01 22:22 Quote from: lucamar on December 01, 2018, 10:58:54 pmSorry, by "DOS box" I meant a computer with a real DOS (as in MS-DOS, DR-DOS, FreeDOS, ...) in it, not the emulator But Windows 98 (boot-up with no GUI, I hope?) is enough test.Again no difference, same output for Win98 GUI / NoGUI, and the results for Code: [Select]MS-DOS Version 6.22 Abs bug with SSE/GO32V2 x=-1.0000000000000000E+000 sin(x)=-8.41470984807896506665E-0001 abs(x)= 1.0000000000000000E+000 Abs bug with SSE/GO32V2 x=-1.0000000000000000E+000 sin(x)=-8.41470984807896506665E-0001 abs(x)= DOS version run from floppy on real hardware (Pentium 4).