From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28641 invoked by alias); 23 Jun 2009 19:25:49 -0000 Received: (qmail 28606 invoked by uid 48); 23 Jun 2009 19:25:37 -0000 Date: Tue, 23 Jun 2009 19:25:00 -0000 From: "simon at josefsson dot org" To: glibc-bugs@sources.redhat.com Message-ID: <20090623192536.10320.simon@josefsson.org> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug libc/10320] New: erand48 implementation not thread safe but POSIX says it should be X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00106.txt.bz2 POSIX specification for erand48: http://www.opengroup.org/onlinepubs/9699919799/functions/erand48.html It doesn't say the function may be non-reentrant, which IIUC, means it should be thread safe. However the implementation of erand48 does use a global variable: http://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/erand48.c;hb=HEAD The variable is __libc_drand48_data and is defined in: http://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/drand48-iter.c;hb=HEAD I can't find anyplace where it is made thread-local, so I'm assuming it is a real global variable. As far as I can tell, there is no requirement in the specification that erand48 update the global drand48 state. -- Summary: erand48 implementation not thread safe but POSIX says it should be Product: glibc Version: 2.11 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: drepper at redhat dot com ReportedBy: simon at josefsson dot org CC: glibc-bugs at sources dot redhat dot com http://sourceware.org/bugzilla/show_bug.cgi?id=10320 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.