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

Bug#761175: kfreebsd i386 changing x87 precision mode in pthreads



On 11.09.2014 13:42, Petr Salinger wrote:
> Package: libc0.1
> Version: 2.13-38+deb7u2
> X-Debbugs-CC: jtaylor.debian@googlemail.com , debian-bsd@lists.debian.org
> 
> On Sat, 6 Sep 2014, Julian Taylor wrote:
...
> 
> The thread started in kernel have different default precision
> in FreeBSD compared to Linux.
> 
> The initial value of precision is set-up before main() starts,
> but not in each thread.
> 
> We should think about how it should be fixed.
> The new thread should either inherit FPU control word from parent, or it
> should be created with the same value as original main().
> 
> Julian, please, could you verify behaviour of linux-i386 ?

i386 seems to inherit the parent control word.
gcc test.c -g -pthread && ./a.out
main starts with 37F
set main to 7F
thread starts with 7F
set thread to 27F
main after join 7F

(on fisher main starts with 137F and thread starts with 127F)

This also matches what  System V Application Binary Interface for amd64
states in section 3.4.2:

3.4.2 Thread State
New threads inherit the floating-point state of the parent thread and
the state is private to the thread thereafter.


Reply to: