Date: Wed, 29 Sep 2010 15:24:08 -0300 From: Renato Botelho <rbgarga@gmail.com> To: perl@freebsd.org Subject: Re: Clang now builds world and kernel, on i386 and amd64 Message-ID: <AANLkTikHnfHP_Eqni2VMDeHHDep6F5rfonHEzNQo-Zip@mail.gmail.com> In-Reply-To: <AANLkTimvdNqcV7b8OtTVYAkc3%2B8Q9xx2tuk5ma5_B1zt@mail.gmail.com> References: <4C99A53E.7060707@FreeBSD.org> <AANLkTimYj1VnVQBLROE94rqPYO7pQyHWfpjiYYZ2ORrX@mail.gmail.com> <AANLkTikm0FrJbOTiRPQhcqM30N-GyOYRBk_8jR-Gq9jF@mail.gmail.com> <20100929002843.GA5001@oriental.arm.org> <4CA2E00D.3080102@FreeBSD.org> <AANLkTik4k%2Bg8NGwRUp=7bvF2MiHhbBOHmA=Ree_-xRDT@mail.gmail.com> <4CA3244D.7030907@FreeBSD.org> <20100929155659.GA82433@oriental.arm.org> <20100929173158.GA73653@freebsd.org> <AANLkTi=6n0%2BEYsXT5aG_mjFmTK=fUYhwptvW%2Bn4zQMOK@mail.gmail.com> <20100929174434.GA75072@freebsd.org> <AANLkTimvdNqcV7b8OtTVYAkc3%2B8Q9xx2tuk5ma5_B1zt@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Sep 29, 2010 at 3:02 PM, Renato Botelho <rbgarga@gmail.com> wrote: > Could you guys give us some help on this? > > > ---------- Forwarded message ---------- > From: Roman Divacky <rdivacky@freebsd.org> > Date: Wed, Sep 29, 2010 at 2:44 PM > Subject: Re: Clang now builds world and kernel, on i386 and amd64 > To: Renato Botelho <rbgarga@gmail.com> > Cc: Derek Tattersall <dlt@mebtel.net>, Dimitry Andric > <dim@freebsd.org>, current@freebsd.org > > > On Wed, Sep 29, 2010 at 02:41:17PM -0300, Renato Botelho wrote: >> On Wed, Sep 29, 2010 at 2:31 PM, Roman Divacky <rdivacky@freebsd.org> wrote: >> > On Wed, Sep 29, 2010 at 11:56:59AM -0400, Derek Tattersall wrote: >> >> * Dimitry Andric <dim@freebsd.org> [100929 08:55]: >> >> > On 2010-09-29 13:23, Renato Botelho wrote: >> >> > > #!/usr/bin/perl >> >> > > >> >> > > use File::Temp; >> >> > > >> >> > > my ( $fh, $filename ) = File::Temp::tempfile(); >> >> > > print "$filename\n"; >> >> > >> >> > For me it works perfectly, though I am using perl 5.10: >> >> > >> >> > $ cat foo.pl >> >> > #!/usr/bin/perl >> >> > >> >> > use File::Temp; >> >> > >> >> > my ( $fh, $filename ) = File::Temp::tempfile(); >> >> > print "$filename\n"; >> >> > $ perl -v >> >> > >> >> > This is perl, v5.10.1 (*) built for i386-freebsd-64int >> >> > >> >> > Copyright 1987-2009, Larry Wall >> >> > >> >> > Perl may be copied only under the terms of either the Artistic License or the >> >> > GNU General Public License, which may be found in the Perl 5 source kit. >> >> > >> >> > Complete documentation for Perl, including FAQ lists, should be found on >> >> > this system using "man perl" or "perldoc perl". ?If you have access to the >> >> > Internet, point your browser at http://www.perl.org/, the Perl Home Page. >> >> > >> >> > $ perl foo.pl >> >> > /tmp/tv25CPnWhF >> >> > $ perl foo.pl >> >> > /tmp/L2UJQ5_JJs >> >> > $ perl foo.pl >> >> > /tmp/6ynQYvWIc1 >> >> > $ perl foo.pl >> >> > /tmp/Tdpf7PKBMg >> >> > $ perl foo.pl >> >> > /tmp/76ir2i1ici >> >> > $ perl foo.pl >> >> > /tmp/LhfD0eZgd8 >> >> > >> >> > I'll try building perl 5.12 and try it again. >> >> > >> >> > Btw, I assume you did *not* rebuild perl with clang, so your perl is >> >> > still compiled with gcc? >> >> > _______________________________________________ >> >> > freebsd-current@freebsd.org mailing list >> >> > http://lists.freebsd.org/mailman/listinfo/freebsd-current >> >> > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" >> >> I built a test case using perl 5.12 and demonstrated that calling int(rand()) >> >> in perl returns NAN, as does calling rand() by itself. ?A "C" program >> >> that calls libc's rand() does return differing integers. ?The perl >> >> documentation claims that perl's rand() calls "C"s rand() and srand() if >> >> necessary. ?I think this effectively demonstrates that the problem lies >> >> with the perl function rand() and it's interface to libc's rand() as >> >> provided by clang. >> >> >> >> On a recent stable system, perl's mktemp works fine. ?The only real >> >> difference is that libc on stable is built with gcc and libc on current >> >> is built with clang. >> > >> > what does this show with clang libc? >> > >> > perl -e 'print int(rand(60)) . " \n" foreach (1 .. 10)' >> > >> > I guess it returns all 0, as the $CHAR[0] is 'A', can you test that? >> > >> >> root@botelhor:/usr/src/lib/libc# perl -e 'print int(rand(60)) . " \n" >> foreach (1 .. 10)' >> nan >> nan >> nan >> nan >> nan >> nan >> nan >> nan >> nan >> nan > > heh, now I noticed that Derek already wrote that ;) is anyone able > to find where in perl sources the rand function is defined? I failed > that :( > > > > -- > Renato Botelho > Sent to rdivacky and current and forgot to copying you, problem is not perl related, sorry about noise. It's using drand48() instead of rand() root@botelhor:/usr/ports/lang/perl5.12# make configure |& grep -i rand drand48_r() NOT found. random_r() NOT found. srand48_r() NOT found. srandom_r() NOT found. Looking for a random number function... Good, found drand48(). Use which function to generate random numbers? [drand48] Checking how to generate random libraries on your machine... Test results here: GCC libc: garga@botelhor:~/testes> ./test random value 0.396465 clang libc: garga@botelhor:~/testes> ./test random value -inf Source of test.c: #include <stdlib.h> #include <stdio.h> #include <string.h> int main() { printf("random value %f\n", drand48()); exit(0); } -- Renato Botelho
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikHnfHP_Eqni2VMDeHHDep6F5rfonHEzNQo-Zip>