c++ - Valgrind reporting invalid read on one system but not another -


i need run rather large software package on new machine work. application written in c , c++ , running on centos 6.5.

the program builds fine, segfaults when go run it. using valgrind, see following error reported @ location of segfault:

==23843== invalid read of size 4 [stack trace here] ==23843==  address 0x642e7464 not stack'd, malloc'd or (recently) free'd 

so reason reading memory aren't supposed , invoking undefined behaviour. when tar source files, take them centos 6.5 machine (w/ same kernel) , compile them (with same makefiles , same gcc version) program seems run fine.

i ran valgrind on machine , expected see invalid read again. thought invalid read present, yet because behaviour undefined things happened work correctly on 1 machine , not on other.

what found, however, valgrind reports no read errors on second machine. how possible?

valgrind makes running environment more deterministic, not eliminate randomness. maybe other machine has bit different versions of libraries installed, or external using (files, network..) different, code execution not have same.

you should @ stack trace , analyze code error happens. if not obvious stack trace alone, can start valgrind --vgdb=full parameter. pause execution once error happens , print out instructions how attach gdb. or can run program under debugger directly - wrote crashes without valgrind.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -