On Thu, 2012-02-23 at 17:59 +0800, 张昭 wrote:

> 
> 
> 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;
> }
>  
>     and I find this result; why? I always have a array out of bounds
> but valgrind doesn't found that? Help
>  
See in the user manual the description of the heuristic used by sgcheck.
http://www.valgrind.org/docs/manual/sg-manual.html#sg-manual.overview
section 11.3.

Basically, if the *same* instruction accesses first inside an array,
and then outside an array, then sgcheck will detect the array out of
bounds. 

In the above case, each instruction is executed only once, and so
the heuristic cannot find it.

Philippe





------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to