From: Sebastian <sc...@nb...> - 2003-04-14 14:38:09
|
Hello, I use valgrind a lot and its a really decent program. Today I stumbled across a quite weird thing which might be a bug in my program, in valgrind or in both. This is how both valgrind 1.0.4 (debian unstable) and 1.9.4 (selfcompiled) complains about code in my program. The first complaint is: ==1682== Use of uninitialised value of size 8 ==1682== at 0x804AB95: be_random_prob (utility.c:111) ==1682== by 0x804F7CB: codegen_getreg (codegen.c:165) Where the interesting part of this function is this: 0x804ab7e <be_random_prob+69>: push $0xffffffff 0x804ab80 <be_random_prob+71>: call 0x804aa89 <be_random> 0x804ab85 <be_random_prob+76>: add $0x10,%esp 0x804ab88 <be_random_prob+79>: mov %eax,0xffffffec(%ebp) 0x804ab8b <be_random_prob+82>: mov 0xffffffec(%ebp),%eax 0x804ab8e <be_random_prob+85>: mov $0x0,%edx 0x804ab93 <be_random_prob+90>: push %edx 0x804ab94 <be_random_prob+91>: push %eax 0x804ab95 <be_random_prob+92>: fildll (%esp,1) 0x804ab98 <be_random_prob+95>: lea 0x8(%esp,1),%esp 0x804ab9c <be_random_prob+99>: fstpl 0xfffffff0(%ebp) It extracted all functions taking part in this code to extra files and ran some tests, without successes. The situation is quite simple: be_random returns one random unsigned int (in %eax), %edx is zeroed out, a 64 bit integer is temporarily created on the stack and the resulting number is loaded into a double register (fildll). The code was generated by gcc 3.2.3 without any optimizations active. I attached a test program to this mail, which does _not_ reproduce the bug, but contains exactly the same code (which I believe to be correct). So, could the valgrind complaint be a side effect of an uncatched bug in my program earlier or is it possibly a bug in valgrind? (I can provide the original program triggering the bug as binary to the authors if they wish so, but not to the list). ciao, Sebastian -- -. sc...@nb... -. + http://segfault.net/~scut/ `--------------------. -' segfault.net/~scut/pgp `' 5453 AC95 1E02 FDA7 50D2 A42D 427E 6DEF 745A 8E07 `- 4 BLU-82/MOAB articles offered, payment due. hi echelon! -----------------' |