nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] mhstore dumps core

2017-08-19 08:41:28
Hi David,

valgrind here, 3.13.0-2, doesn't complain about the printf, and that
prints zero.  That puzzles me.

Yes, interesting.  Have you tried with -O0?

gcc 7.1.1-4.  valgrind 3.13.0-2.

    With -D_FORTIFY_SOURCE=2:
        -O0  Compile fails;  optimisation needed.
        -O2  valgrind finds the problem.
        -O3  valgrind doesn't complain.  My default.

    Without -D_FORTIFY_SOURCE=2:
        -O0  valgrind finds the problem.
        -O2  valgrind finds the problem.
        -O3  gcc finds the problem, valgrind doesn't.

So valgrind looks best with -O2, but gcc spots some problems itself at
-O3 if no -D_FORTIFY_SOURCE=2.

    http://valgrind.org/docs/manual/manual-core.html#manual-core.started

    If you are planning to use Memcheck: On rare occasions, compiler
    optimisations (at -O2 and above, and sometimes -O1) have been
    observed to generate code which fools Memcheck into wrongly
    reporting uninitialised value errors, or missing uninitialised value
    errors.  We have looked in detail into fixing this, and
    unfortunately the result is that doing so would give a further
    significant slowdown in what is already a slow tool.  So the best
    solution is to turn off optimisation altogether.  Since this often
    makes things unmanageably slow, a reasonable compromise is to use
    -O.  This gets you the majority of the benefits of higher
    optimisation levels whilst keeping relatively small the chances of
    false positives or false negatives from Memcheck.

I'm ambivalent about OK and NOTOK.  Sometimes they provide more
readable code, I think, but not always.

Yes, I expect they're right some of the time.  :-)

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>