Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Baurzhan Ismagulov
On Wed, Nov 02, 2011 at 08:01:34AM -0700, Dan Kegel wrote: > Don't forget about gcc's -fstack-protector-all option. That can find > a few things. I've already tried this with the OP's example, didn't help. With kind regards, Baurzhan.

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Dan Kegel
On Wed, Nov 2, 2011 at 6:55 AM, Baurzhan Ismagulov wrote: > On Wed, Nov 02, 2011 at 09:42:41AM -0400, Jeffrey Walton wrote: >> > It worked for me for overflows (e.g., i = 2) but not underflows (with -1 >> > as in your original posting), regardless of how i has been set. That's >> > interesting, I

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Baurzhan Ismagulov
On Wed, Nov 02, 2011 at 09:42:41AM -0400, Jeffrey Walton wrote: > > It worked for me for overflows (e.g., i = 2) but not underflows (with -1 > > as in your original posting), regardless of how i has been set. That's > > interesting, I wasn't aware of that. > Did you try Clang with UBC Integer Overf

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Jeffrey Walton
Hi Baurzhan, On Wed, Nov 2, 2011 at 9:34 AM, Baurzhan Ismagulov wrote: > On Wed, Nov 02, 2011 at 01:55:50PM +0100, Peter Toft wrote: >> > There is also mudflap of gcc which claims to catch exactly this sort >> > of errors. >> >> I might be mistaking here but if the value if "i" is set from ar

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Baurzhan Ismagulov
On Wed, Nov 02, 2011 at 01:55:50PM +0100, Peter Toft wrote: > > There is also mudflap of gcc which claims to catch exactly this sort > > of errors. > > I might be mistaking here but if the value if "i" is set from argv > or alike then mudflap cannot help on this problem. It worked for me for

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Peter Toft
On Wed, 2 Nov 2011 13:20:55 +0100, Baurzhan Ismagulov wrote: > On Tue, Nov 01, 2011 at 11:33:20PM +0100, Peter Toft wrote: >> 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]); > ... > >> Are there supplementary tools I should ch

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Baurzhan Ismagulov
On Tue, Nov 01, 2011 at 11:33:20PM +0100, Peter Toft wrote: > 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]); ... > Are there supplementary tools I should check? There is also mudflap of gcc which claims to catch e

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Peter Toft
On Wed, 2 Nov 2011 11:56:58 +0100, Julian Seward wrote: > 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

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Julian Seward
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

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Tom Hughes
On 02/11/11 10:18, Peter Toft wrote: > I cannot see tha that other two tools do much better on this kind of > coding problem. I see the same, which did surprise me a little. > Maybe that I do not give valgrind sufficient amount of options. Can you > comment? Well it is an experimental tool (hen

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Tom Hughes
On 02/11/11 07:41, Peter Toft wrote: > Actually in the future I would wish that memcheck could be extended so > it could catch it - even if it would cost compile-time changes. > > Valgrind is a great tool, but its user-value would increase quite a bit, > if it could catch a bit more (e.g. like my

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Tom Hughes
On 02/11/11 07:36, Peter Toft wrote: > Valgrind _does_ point to the problematic area - but finds the problem as > a unitialized values. Quite possible, depending on how the compiler chooses to arrange the stack. > I did not know that the values I get with my example is different from > 32 bit to

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Peter Toft
On Wed, 02 Nov 2011 08:41:25 +0100, Peter Toft wrote: > On Wed, 02 Nov 2011 00:32:44 +, Tom Hughes wrote: > >> On 01/11/11 22:33, Peter Toft wrote: >> >>> Try to find the errors in this C/C++ snippet using valgrind: #include /* Save as code.c */ int main(void) { int i=-1,a[2],b[2],c[2]

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Peter Toft
On Wed, 02 Nov 2011 00:32:44 +, Tom Hughes wrote: > On 01/11/11 22:33, Peter Toft wrote: > >> Try to find the errors in this C/C++ snippet using valgrind: #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; p

Re: [Valgrind-users] The bug that got away...

2011-11-02 Thread Peter Toft
On Tue, 01 Nov 2011 20:28:34 -0400, Florian Krohm wrote: > On 11/01/2011 06:33 PM, Peter Toft wrote: >> Hi all >> >> Try to find the errors in this C/C++ snippet using valgrind: >> >> #include >> /* Save as code.c */ >> int main(void) >> { >> int i=-1,a[2],b[2],c[2]; >> a[0] = 1; a[1] = 2;