I had a problem like last May, though it may not have been the same problem. In 
my case it was the optimization settings. I typically used -O0 for valgrind, 
and at -O0 the program didn’t crash. At level -O1 or higher it always crashed. 
I can’t recall if I ran it in valgrind at -O1 or higher, but if I did then that 
didn’t help me find the problem, either.

In the end I combed through the code where the problem was occurring, and 
discovered that I had forgotten to return a value from a function that was 
declared to return bool. I hadn’t noticed the compiler warning in the 20 
screens of Makefile messages that scrolled by.

I hope that’s somehow helpful.

john perry

> On Jan 26, 2019, at 5:12 PM, Peng Yu <pengyu...@gmail.com> wrote:
> 
> Hi,
> 
> I have an executable. If I just run on its own, there will be
> segmentation fault. But if I run it using valgrind, it finishes
> successfully. Does anybody how can this happen? How to debug such a
> program? Thanks.
> 
> -- 
> Regards,
> Peng
> 
> 
> _______________________________________________
> Valgrind-users mailing list
> Valgrind-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/valgrind-users


_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to