Bug#137020: acknowledged by developer (Bug#137020: fixed in glibc 2.3.1-15)
At Fri, 28 Mar 2003 14:54:24 +0100,
Vincent Lefevre wrote:
>
> On Fri, Mar 28, 2003 at 22:04:26 +0900, GOTO Masanori wrote:
> > I tested as:
> >
> > #include <stdio.h>
> > #include <fpu_control.h>
> >
> > main()
> > {
> > unsigned int a;
> >
> > _FPU_GETCW(a);
> > _FPU_SETCW(a);
> > printf("%x\n",a);
> > }
> >
> > Original bug does not say "_FPU_RC_ZERO". You _have to_ send a
> > test program to report BTS in the next time.
>
> OK. But note that I did (very shortly) explain the problem in my
> original bug report.
>
> On Fri, Mar 28, 2003 at 22:19:23 +0900, GOTO Masanori wrote:
> > ... and this bug is really fixed in glibc 2.3.2-1.
>
> I haven't seen glibc 2.3.2-1.
Ah, I should say:
"this bug will be fixed in glibc 2.3.2-1 which will be
released as the next version of the current glibc 2.3.1-16"
> When you say "fixed", did you test with _FPU_RC_ZERO only or did you
> check the code?
Yes.
> In particular, the following test program would have failed too
> with glibc 2.3.1:
>
> #include <stdio.h>
> #include <fpu_control.h>
>
> main()
> {
> unsigned int d;
>
> _FPU_GETCW(d);
> _FPU_SETCW(d);
> printf("%x\n",d);
> }
>
> (This is your test program where 'a' has been replaced by 'd'.)
This problem is caused by fpu_control.h with incomplete definition of
_FPU_GETCW, _FPU_SETCW. Rewrite your /usr/include/fpu_control.h
as follows (it's pulled from glibc 2.3.2):
/* Macros for accessing the hardware control word. */
#define _FPU_GETCW(__cw) ( { \ <-
union { double d; fpu_control_t cw[2]; } \
tmp __attribute__ ((__aligned__(8))); \
__asm__ ("mffs 0; stfd%U0 0,%0" : "=m" (tmp.d) : : "fr0"); \
(__cw)=tmp.cw[1]; \ <-
tmp.cw[1]; } )
#define _FPU_SETCW(__cw) { \ <-
union { double d; fpu_control_t cw[2]; } \
tmp __attribute__ ((__aligned__(8))); \
tmp.cw[0] = 0xFFF80000; /* More-or-less arbitrary; this is a QNaN. */ \
tmp.cw[1] = __cw; \ <-
__asm__ ("lfd%U0 0,%0; mtfsf 255,0" : : "m" (tmp.d) : "fr0"); \
}
The point is "__cw". Please check.
Regards,
-- gotom
Reply to: