Da,

You don’t show the code that’s calling rand_permute::rand_permute(long,
int).  In particular, the passed in value of stride could be uninitialized.

Geoff

-----Original Message-----
From: Zheng Da [mailto:[email protected]]
Sent: Saturday, May 05, 2012 2:26 PM
To: Philippe Waroquiers
Cc: [email protected]
Subject: Re: [Valgrind-users] valgrind prints out a lot of error messages
pointing to the standard library

hello,
> ==32701== Conditional jump or move depends on uninitialised value(s)
> ==32701==    at 0x4FB3D9: fillin_rpath
> (in /home/zhengda/Dropbox/research/read-test/rand-read)
> ==32701==    by 0x4FDBCB: _dl_init_paths
> (in /home/zhengda/Dropbox/research/read-test/rand-read)
> ==32701==    by 0x4CCC58: _dl_non_dynamic_init
> (in /home/zhengda/Dropbox/research/read-test/rand-read)
> ==32701==    by 0x4CD762: __libc_init_first
> (in /home/zhengda/Dropbox/research/read-test/rand-read)
> ==32701==    by 0x47F795: (below main)
> (in /home/zhengda/Dropbox/research/read-test/rand-read)
> ==32701==
The above error for example looks to somewhat match a suppression in
glibc-2.3.supp

It is however not clear what is the cause of all these errors
not being suppressed.
Note that usually, having more info such as Valgrind version,
OS and distribution version, cpu etc might only help to guess
what it is :).
Sorry, I forget.
I use valgrind-3.6.1,
ubuntu 11.04,
Xeon(R) CPU E5405
Linux 2.6.38.8

Other than the errors in the standard library, it also shows many errors in
my own program and I found the error messages are also very misleading.

==21746== Use of uninitialised value of size 8
==21746==    at 0x40D168: rand_permute::rand_permute(long, int)
(workload.h:63)
==21746==    by 0x410624:
global_rand_permute_workload::global_rand_permute_workload(long, int, long,
long) (workload.h:165)
==21746==    by 0x40F3FD: main (rand-read.cc:475)
==21746==

The corresponding code is shown below. I don't understand which variable
isn't initialized?

 54 class rand_permute
 55 {
 56     off_t *offset;
 57     long num;
 58
 59 public:
 60     rand_permute(long num, int stride) {
 61         offset = (off_t *) valloc(num * sizeof(off_t));
 62         for (int i = 0; i < num; i++) {
 63             offset[i] = ((off_t) i) * stride;
 64         }
 65
 66         for (int i = num - 1; i >= 1; i--) {
 67             int j = random() % i;
 68             off_t tmp = offset[j];
 69             offset[j] = offset[i];
 70             offset[i] = tmp;
 71         }
 72     }

Thanks,
Da
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to