|
From: Brian B. <bri...@gm...> - 2012-02-23 14:24:58
|
On Thu, Feb 23, 2012 at 1:59 AM, 张昭 <mai...@gm...> wrote:
> Hi all:
> I use
> zhangzhao-debian:~/work/tests# /opt/valgrind-3.7.0/bin/valgrind --version
> valgrind-3.7.0
> to test follow code
> #include <stdlib.h>
>
> static int b[60];
> int main ( int argc, char *argv[] )
> {
> int a[50];
> int ret;
> /*a[50] = 1;
> a[51] = 1;*/
> b[59] = 1;
> b[60] = 2;
> return EXIT_SUCCESS;
> }
> compile use gcc -g array.c -o array and run with
> zhangzhao-debian:~/work/tests# /opt/valgrind-3.7.0/bin/valgrind
> --tool=exp-sgcheck ./array
> ==14029== exp-sgcheck, a stack and global array overrun detector
> ==14029== NOTE: This is an Experimental-Class Valgrind Tool
> ==14029== Copyright (C) 2003-2011, and GNU GPL'd, by OpenWorks Ltd et al.
> ==14029== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
> ==14029== Command: ./array
> ==14029==
> ==14029==
> ==14029== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
> zhangzhao-debian:~/work/tests#
>
> and I find this result; why? I always have a array out of bounds but
> valgrind doesn't found that? Help
>
> zhangzhao
>
Try using the exp-sgcheck tool instead of memcheck.
Brian
|