On Wednesday, November 02, 2011 09:31:18 am Peter Toft wrote:

> #include /* Save as code.c */ 
> int main(void) { int
> i=-1,a[2],b[2],c[2]; 
> a[0] = 1; a[1] = 2; b[0] = 3; b[1] = 4; c[0] = 5;
> c[1] = 6; 
> printf("%i %in",b[i],a[i]); return 0;
> } 

> I cannot see exp-sgcheck catching anything (compiled from the SVN
> version) :/

Yeah.  That's because of the limitations of how sgcheck works.  Have a
look at 
http://www.valgrind.org/docs/manual/pc-manual.html#pc-manual.limitations
and specifically at the 4th bullet point ("Stack checks: It follows ...")

If you change your test program so that each memory referencing insn
iterates over an array and goes out of bounds, then it should get
spotted.  But that's not the case here: each memory referencing insn
(for the various arrays) is only used once and so there's no opportunity
for the tool to infer which array each instruction is probably "supposed"
to access.  (That probably won't make much sense until you read the
URL above ..)

J

------------------------------------------------------------------------------
RSA® Conference 2012
Save $700 by Nov 18
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to