|
From: 奕楠 邱 <mag...@ho...> - 2011-12-06 08:14:19
|
Hello: I write a program to store the integer into the integer array(for example: the array size is 10, but I store 11 elements) when I use gcc -o test test.c, then use ./valgrind --tool=exp-ptrcheck ./test it will not show any error but when I use gcc -Wall -g -o test1 test1.c then use ./valgrind --tool-exp-ptrcheck ./test it will show that Invalid write of size 4==29057== at 0x8048361: main (test.c:8)==29057== Address 0xbee5678c expected vs actual:==29057== Expected: stack array "a" in this frame==29057== static memory SIZE 0 So the useage of valgrind is much related to the compile argument? Can anyone tell me what makes the difference? |
|
From: 奕楠 邱 <mag...@ho...> - 2011-12-07 07:06:25
|
Hello:
I write a program to store the integer into the integer array(for example: the array size is 10, but I store 11 elements)
when I use gcc -o test test.c, then use ./valgrind --tool=exp-ptrcheck ./test it will not show any error
but when I use gcc -Wall -g -o test1 test1.c then use ./valgrind --tool-exp-ptrcheck ./test it will show that
Invalid write of size 4
==29057== at 0x8048361: main (test.c:8)
==29057== Address 0xbee5678c expected vs actual:
==29057== Expected: stack array "a" in this frame
==29057== static memory SIZE 0
So the useage of valgrind is much related to the compile argument? Can anyone tell me what makes the difference?
|