This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Make ARM fesetenv (FE_NOMASK_ENV) detect failure (bug 14866)


On 11/21/2012 02:08 PM, Joseph S. Myers wrote:
> On Wed, 21 Nov 2012, Richard Henderson wrote:
> 
>> On 11/21/2012 12:28 PM, Joseph S. Myers wrote:
>>> +      if (envp == FE_NOMASK_ENV)
>>> +	{
>>> +	  /* VFPv3 and VFPv4 do not support trapping exceptions, so
>>> +	     test whether the relevant bits were set and fail if
>>> +	     not.  */
>>> +	  _FPU_GETCW (temp);
>>> +	  if ((temp & _FPU_IEEE) != _FPU_IEEE)
>>> +	    return 1;
>>> +	}
>>
>> Why test vs FE_NOMASK_ENV explicitly?  In theory the exception value
>> could have come from just about anywhere.
> 
> The fesetenv argument must either be one of the macros from fenv.h, or an 
> environment previously obtained from one of the fenv.h functions in the 
> same execution of the same program (and in the latter case, if these bits 
> are set it means the processor supports them).
> 

Yeah, but the fine point of "same execution same program" could easily be
missed.  I was thinking of a distributed system containing a mix of VFPv2/v3
processors, in which fenv_t values were shared across nodes.

Not so very likely, but why not program more robustly?  Especially if, as I
suspect, the more robust formulation actually results in fewer insns?


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]