Forum > FPC development
FPC 3.3.1 Error 216 General Protection fault for abs with GO32V2 / SSE2
(1/1)
Gammatester:
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 [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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: ---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>
--- End code ---
lucamar:
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:
--- Quote from: lucamar on December 01, 2018, 09:32:42 pm ---Have you tried in an actual DOS box? It may be a strange interaction between the extender and the OS treatment of the FPU.
--- End quote ---
This makes no difference, here the results for Windows 98 and DOSBox (the first runs are without SSE the second with SSE):
--- Code: ---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)=
--- End code ---
Error and error addr only displayed on screen, could not be redirected with DOSBox
lucamar:
Sorry, by "DOS box" I meant a computer with a real DOS (as in MS-DOS, DR-DOS, FreeDOS, ...) in it, not the emulator :D 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:
--- Quote from: lucamar on December 01, 2018, 10:58:54 pm ---Sorry, by "DOS box" I meant a computer with a real DOS (as in MS-DOS, DR-DOS, FreeDOS, ...) in it, not the emulator :D But Windows 98 (boot-up with no GUI, I hope?) is enough test.
--- End quote ---
Again no difference, same output for Win98 GUI / NoGUI, and the results for
--- Code: ---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)=
--- End code ---
DOS version run from floppy on real hardware (Pentium 4).
Navigation
[0] Message Index