This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, libfortran] Multi-threaded random_number
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- Cc: Jerry DeLisle <jvdelisle at charter dot net>, Fortran List <fortran at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 11 Aug 2016 16:54:51 +0200
- Subject: Re: [Patch, libfortran] Multi-threaded random_number
- Authentication-results: sourceware.org; auth=none
- References: <CAO9iq9FeBPjnwMJScLzhyXANkc=z=0AybdW2dNA0z5FcsMsTGw@mail.gmail.com> <CAO9iq9F1RRSWDSiKkyOB1KWvKUbXEL_5KABL5Y_sKHLHaf_wHA@mail.gmail.com> <710d21ad-f79e-a681-bf1a-9be40c0382d6@charter.net> <CAO9iq9Hef=L8nw9=D7vWYjn_qsYWC6RMydNkphAdEdjSD5=9Hw@mail.gmail.com> <CAO9iq9FcHRxPvTS4jbkk=g3Lmrk=NLWUGB5Qn94Sa2ieobn4LQ@mail.gmail.com>
Hi Janne,
> committed a slightly modified patch as r239356. Changes from the
> submitted patch attached. To my surprise, it turned out that my
> fallback code using __gthread_key_{create,delete} and
> __ghtread_{get,set}_specific was faster than my TLS code, so I removed
> the TLS configure magic and the TLS code and just left the __gthread
> stuff in.
this patch broke Solaris bootstrap:
/vol/gcc/src/hg/trunk/local/libgfortran/intrinsics/random.c: In function 'constructor_random':
/vol/gcc/src/hg/trunk/local/libgfortran/intrinsics/
random.c:915:45: error: 'free' undeclared (first use in this function); did you mean 'frexp'?
__gthread_key_create (&rand_state_key, &free);
^~~~
frexp
/vol/gcc/src/hg/trunk/local/libgfortran/intrinsics/random.c:915:45: note: each undeclared identifier is reported only once for each function it appears in
You need to include <stdlib.h> for the free declaration, as this patch
does. Allowed i386-pc-solaris2.12 and sparc-sun-solaris2.12 to
continue. I'm going to install this as obvious.
Rainer
2016-08-11 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
libgfortran:
* intrinsics/random.c: Include <stdlib.h>.
diff --git a/libgfortran/intrinsics/random.c b/libgfortran/intrinsics/random.c
--- a/libgfortran/intrinsics/random.c
+++ b/libgfortran/intrinsics/random.c
@@ -27,6 +27,7 @@ see the files COPYING3 and COPYING.RUNTI
#include "libgfortran.h"
#include <gthr.h>
#include <string.h>
+#include <stdlib.h>
/* For getosrandom. */
#ifdef HAVE_SYS_TYPES_H
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University