[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#761509: sse control word not inherited in pthreads



Package: libc0.1
Version: 2.19-11
X-Debbugs-CC: debian-bsd@lists.debian.org

very similar to bug 761175 about the x87 control word.
but the same issue affects the sse control word mxcsr.
It was not fixed in -11 that fixed the x87 fpu.

(sid_kfreebsd-amd64-dchroot)jtaylor@falla:~$ cat test2.c
#include <pthread.h>
#include <xmmintrin.h>
#include <stdio.h>
#include <fpu_control.h>
#include <fenv.h>

void *thread_fun(void *x_void_ptr)
{
   fenv_t env;
   fegetenv(&env);
   printf("thread mxcsr %x\n", env.__mxcsr);
   return NULL;
}

int main()
{
   pthread_t thread;
   fenv_t env;
   fegetenv(&env);
   printf("main mxcsr pre %x\n", env.__mxcsr);
   _MM_SET_FLUSH_ZERO_MODE (_MM_FLUSH_ZERO_ON);
   fegetenv(&env);
   printf("main mxcsr %x\n", env.__mxcsr);

   if(pthread_create(&thread, NULL, thread_fun, NULL)) {
       fprintf(stderr, "Error creating thread\n");
       return 1;
   }
   if(pthread_join(thread, NULL)) {
       fprintf(stderr, "Error joining thread\n");
       return 2;
   }
   return 0;
} 
$ ./a.out
main mxcsr pre 1f80
main mxcsr 9f80
thread mxcsr 1f80

$ apt-cache  policy libc0.1
libc0.1:
  Installed: 2.19-11
  Candidate: 2.19-11
  Version table:
 *** 2.19-11 0


on linux the control word is inherited as per SysV abi section 3.4.2.


Reply to: