This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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: fegetexceptflag() question for ppc


> Date: Wed, 03 Dec 2003 22:35:13 -0800
> From: Ulrich Drepper <drepper@redhat.com>

> Geoff Keating wrote:
> 
> > On powerpc, the representation is defined to be in the format of the
> > FP environment register with bits other than those specified by
> > 'excepts' having undefined values.
> 
> Exactly.  Indicated by flags, and nothing else.

I didn't understand that sentence.  What is to be indicated by what flags?

> > and these are the only routines that interpret a fexcept_t.  So
> > there's no way a conforming program can tell that fegetexceptflag is
> > returning more information than requested.
> 
> Of course there is.
> 
> If one exception is requested with fegetexceptflag and then fesetexcept
> restores a more general set using fesetexceptflag, only the one
> exception which fegetexceptflag returned must be set and testable via
> fetestexcept after the fesetexceptflag call.
> 
> 
>   fegetexceptflag (&ex, FE_INVALID);
>   fesetexceptflag (&ex, FE_ALL_EXCEPT);
>   r = fetestexcept (FE_DIVBYZERO);
> 
> r must always be zero afterwards.  This is what the other archs do and
> ppc must follow.

That's not conforming ISO C.  The second parameter to fesetexceptflag
must be a subset of the second parameter to fegetexceptflag.  From ISO
C section 7.6.2.4 "The fesetexceptflag function", paragraph 2:

> The value of *flagp shall have been set by a previous call
> to fegetexceptflag whose second argument represented at least those
> floating-point exceptions represented by the argument excepts.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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