[Gc] Re: Problem: FPE mask reset by GC. Versions 7.X on x86_64 Linux.

Jean-Claude Beaudoin jean.claude.beaudoin at gmail.com
Sat Jan 22 17:31:24 PST 2011


Hello Ivan,

How about this here attached?

No -lm, no _GNU_SOURCE, no glibc version to test for...

I basically lifted the source code of fegetexcept() and feenableexcept() directly
from the latest stable Glibc source more or less verbatim with a few simplifications.

Seems to work. What do you say?

Cheers,

Jean-Claude


Ivan Maidanski wrote:
> Hi Jean-Claude,
> 
> Some comments follow.
> 
> Sat, 22 Jan 2011 01:25:57 -0500 письмо от Jean-Claude Beaudoin <jean.claude.beaudoin at gmail.com>:
>> Ivan Maidanski wrote:
>>> Hi,
>>>
>>> Some notes about the patch:
>>> 1. LINUX macro should be tested instead if linux;
>> Sure. I kicked that patch out your way a bit too quickly it seems.
>> I did not think enough beyond my own working context when I did it.
>> It probably is not suitable for general/portable use.
>>
>>> 2. IFAIK this requires -lm linker option (alternatively we could load it
>> dynamically to avoid possible changes of makefiles of the client applications)
>> ;
>>
>> Yes it does require -lm since fegetexcept() and feenableexcept() are both in
>> that library.
>> The alternative would be inline assembly and I am not fluent enough in that to
>> cook it up
>> quickly. On top of it my app links -lm anyway. But you are right to consider
>> this a problem
>> in a more general context.
> 
> This is the major problem. There are 3 ways:
> - use assembly if possible (this is preferred but I'm not a guru in it neither);
> - use dynamic loading;
> - dont define GETCONTEXT_FPU_EXCMASK_BUG at all (in gcconfig.h) but test it in mach_dep.c.
> 
>>> 3. These functions are available only starting from some Glib version (the
>> corresponding macro should be tested).
>>
>> The man page seems to indicate that they started their career with Glibc 2.2
>> which is somewhat
>> ancient from my point of view. As for the macro to test that is way above my
>> head.
> 
> # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2
> 
>>> 4. Should we define _GNU_SOURCE before include fenv.h or not?
>> Yes, define _GNU_SOURCE as you say. My mistake, the man page says to define it
>> and it should be,
>> sorry about that.
> 
> Ok.
> 
> Regards.
> 
>>> 5. It's better to test GETCONTEXT_FPU_EXCMASK_BUG in mach_dep.c and set it
>> in gcconfig.h (please also let me when the bug in glib will be fixed to adjust
>> gcconfig.h then).
>>
>> Sure. I will keep you posted on the evolution of my bug report but jugging
>> from the activity on
>> my bugzilla entry you should not hold you breath, they sure don't seem in any
>> rush about it...
> 
> Not a problem.
> 
>>> Regards.
>>>
>> Cheers.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mach_dep.c.diff
Type: text/x-patch
Size: 924 bytes
Desc: not available
Url : http://napali.hpl.hp.com/pipermail/gc/attachments/20110122/d8c18b1d/mach_dep.c.bin


More information about the Gc mailing list