From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9412 invoked by alias); 9 Feb 2009 14:46:02 -0000 Received: (qmail 9400 invoked by uid 22791); 9 Feb 2009 14:46:01 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.network-theory.co.uk (HELO mail.network-theory.co.uk) (66.199.228.187) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 09 Feb 2009 14:45:47 +0000 Date: Mon, 09 Feb 2009 14:46:00 -0000 Message-ID: From: Brian Gough To: M Joonas Pihlaja Cc: gsl-discuss@sources.redhat.com Subject: Re: Uninitialised rng state In-Reply-To: References: User-Agent: Wanderlust/2.14.0 (Africa) Emacs/22.2 Mule/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Message-Mac: 3c4854708126be41c8adf9556e1bb4f3 Mailing-List: contact gsl-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gsl-discuss-owner@sourceware.org X-SW-Source: 2009-q1/txt/msg00007.txt.bz2 At Sat, 7 Feb 2009 08:30:41 +0200 (EET), M Joonas Pihlaja wrote: > One example is mt19937 whose state has lots of unsigned longs > followed by an int. On a 64 bit machine the size of the state is > 5000 bytes of which 4 bytes are pad bytes inserted by the > compiler due to the mix of int/ulong. So later when I twiddle > the state valgrind triggers on the uninitialised access. So I was > wondering whether gsl_rng_alloc() really ought to calloc the > state instead of mallocing it. Thoughts? > > As a workaround I'm currently clearing the entire state right > after calling gsl_rng_alloc() and then calling gsl_rng_set(rng, > gsl_rng_default_seed) right after. This does quell valgrind, but > is it a sane thing to do? Hello, Valgrind 3.1 does not detect any errors for me when running the gsl-1.12 rng test program on x86_64 with gcc 4.0.3 (apart from in the fread and fwrite functions, where they're expected). Can you send a full bug report to bug-gsl@gnu.org with the program, complete valgrind error message, version of valgrind and gsl that you use, and the compiler. Thanks. -- Brian Gough