[fpc-devel] OpenGL and glut bugs in Freepascal 2.1.1runningwith Mac Os X Tiger ?

Matthias Krenzer nexus at gmx.net
Fri Nov 4 22:23:26 CET 2005


----- Original Message ----- 
From: "Adriaan van Os" <fpc at microbizz.nl>
To: "FPC developers' list" <fpc-devel at lists.freepascal.org>
Sent: Thursday, November 03, 2005 10:48 AM
Subject: Re: [fpc-devel] OpenGL and glut bugs in Freepascal 2.1.1runningwith 
Mac Os X Tiger ?


> Nexus wrote:
>
>> <snip>
>> An unhandled exception occurred at $903E68B8 :
>> EInvalidOp : Invalid floating point operation
>> <snip>
>> So it first seems to be some error in the fpu code generation of the 
>> compiler. But the strange things is, after running a C-Program which uses 
>> glut and open gl everything just works fine. So maybe there is something 
>> wrong in the open gl / glut initialization part or some incompatibilities 
>> with Mac OS X 10.4
>> <snip>
>
> Just a guess - could this be the same problem as discussed in the 
> "[fpc-devel] MacOSX: EXC_ARITHMETIC in PerformHIConversion" thread, where 
> Jonas Maebe wrote:
>
>>>>> Are these exceptions by default disabled by gcc ?
>>>>
>>>> The FPC runtime explicitly turns them on by default (since they are 
>>>> required for detecting errors), while libc doesn't. It is independent 
>>>> of the compiler used.
>>>>
>>>
>>> So, if I understand it correct, you wont get a aritmic exeption in FPC 
>>> anymore when this is turned on ?
>>
>> The "invalid fpu operation" exceptions are turned on in the FPC system 
>> unit initialisation code. If you add the code I posted, they are turned 
>> off again and so you won't get them (not due to buggy code in the Carbon 
>> framework and not anywhere else either).
>
> Regards,
>
> Adriaan van Os
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>

Thank you very much for your help (all of you).

You were absolutely right. It seems to be the same problem as discussed in 
the "[fpc-devel] MacOSX: EXC_ARITHMETIC in PerformHIConversion" thread.
I ran the programs with Mac OS X 10.3 and they were running just fine. They 
just crash with Mac OS X 10.4.x.

It seems to be the same bug in the Carbon framework under Mac OS X 10.4.x 
mentioned in this thread, which causes to generate invalid floating point 
operation exceptions in some cases. By disabling these exceptions as 
mentioned in the EXEC_ARITHMETIC thread with
asm
    mtfsfi 6,1
  end;
everything works now with Mac OS X 10.4 as it should.

 But two questions remain:

1.) Why are the fpc applications running fine after running some open gl 
applications written in c ? (maybe i didn't get it yet, sorry)

2.) It does not sound very safe to turn of the floating point exceptions 
forever (or at least until Mac OS X 10.5). Is there any possibility to 
create some clean workaround without needing the divine intervention of the 
apple fixing the carbon libs in 10.4 ?

Thanks again






More information about the fpc-devel mailing list