View Issue Details

IDProjectCategoryView StatusLast Update
0037907FPCCompilerpublic2020-10-25 18:10
ReporterAlfred Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionwon't fix 
PlatformHaiku 
Product Version3.3.1 
Summary0037907: Building compiler on Haiku fails with FPU exception
DescriptionThe compiler exception mask does not mask enough exceptions on Haiku.
Proposed change for Haiku: Default8087CW : word = $137F;
With this change, the compiler gets build with success.

The included patch could be applied to trunk and fixes also.
Additional InformationSee forum: https://forum.lazarus.freepascal.org/index.php/topic,50362.msg380331.html#msg380331
Please apply to fixes also.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

Alfred

2020-10-11 11:18

reporter  

fpcpatch_haikufpu.patch (472 bytes)   
Index: rtl/inc/mathh.inc
===================================================================
--- rtl/inc/mathh.inc	(revision 43466)
+++ rtl/inc/mathh.inc	(working copy)
@@ -16,7 +16,11 @@
 
 {$if defined(cpui8086) or defined(cpui386) or defined(cpux86_64)}
     const
+    {$ifdef Haiku}
+      Default8087CW : word = $137F;
+    {$else}
       Default8087CW : word = $1332;
+    {$endif}
 
     procedure Set8087CW(cw:word);
     function Get8087CW:word;
fpcpatch_haikufpu.patch (472 bytes)   

Alfred

2020-10-11 11:47

reporter   ~0126235

It could be that the proposed mask is masking too much. To analyze, included screenshot of crash report.
HaikuException.JPG (131,418 bytes)   
HaikuException.JPG (131,418 bytes)   

Florian

2020-10-11 21:14

administrator   ~0126245

I cannot make anything out of the crash report. So shall we apply the patch or not?

Alfred

2020-10-11 21:20

reporter   ~0126247

Yes, please apply the patch. Its just a blocking Haiku-quirk. Tests show no negative side-effects.

Marco van de Voort

2020-10-11 21:41

manager   ~0126248

Related to r46210 ?

Sven Barth

2020-10-12 11:36

manager   ~0126253

What I don't get is why it's saying "unexpected exception in kernel mode". Is the Haiku kernel not able to handle the usermode switching on certain math exceptions? If so that would be a bug in Haiku in my opinion...

Alfred

2020-10-13 12:39

reporter   ~0126280

I did some more research. The FPU exception can be masked by setting only the "Invalid Operation Exception"-bit.
Seemingly, an arithmetic instruction has encountered an invalid operand. Somewhere. Unknown.
However, this is enough to get things running on Haiku:
Default8087CW : word = $1333;
Please apply.

Sven Barth

2020-10-14 12:56

manager   ~0126292

I'm still not sure whether this is simply solving the symptom instead of the cause.

Florian

2020-10-15 21:25

administrator   ~0126337

I agree with Sven, we shouldn't apply a patch which just hides bugs of the OS.

Alfred

2020-10-18 18:49

reporter   ~0126400

As I do not know the real cause of this issue, I can offer no help in resolving. I am also definitely no Haiku expert.
So, this issue might be closed.

In the meantime, I will let fpcupdeluxe patch the FPC sources to mask the "Invalid Operation Exception"-bit to get a running FPC on Haiku. And will keep track of user reports.

Issue History

Date Modified Username Field Change
2020-10-11 11:18 Alfred New Issue
2020-10-11 11:18 Alfred File Added: fpcpatch_haikufpu.patch
2020-10-11 11:47 Alfred Note Added: 0126235
2020-10-11 11:47 Alfred File Added: HaikuException.JPG
2020-10-11 21:14 Florian Note Added: 0126245
2020-10-11 21:15 Florian Status new => feedback
2020-10-11 21:15 Florian FPCTarget => -
2020-10-11 21:20 Alfred Note Added: 0126247
2020-10-11 21:20 Alfred Status feedback => new
2020-10-11 21:41 Marco van de Voort Note Added: 0126248
2020-10-12 11:36 Sven Barth Note Added: 0126253
2020-10-13 12:39 Alfred Note Added: 0126280
2020-10-14 12:56 Sven Barth Note Added: 0126292
2020-10-15 21:25 Florian Note Added: 0126337
2020-10-18 18:49 Alfred Note Added: 0126400
2020-10-25 18:10 Florian Assigned To => Florian
2020-10-25 18:10 Florian Status new => resolved
2020-10-25 18:10 Florian Resolution open => won't fix