Hello,

Valgrind reports "invalid read" in my program, but only if I compile it
with -O3 and not if I compile it with -O2, -O1 or -O0. The -g option
doesn't change this. Is it possible that valgrind reports false
positives if the -O3 option is used? If yes, how can I confirm this
message is indeed a false positive?

I couldn't find anything in the documentation except for this quote from
https://valgrind.org/docs/manual/quick-start.html:

Compile your program with |-g| to include debugging information so that
Memcheck's error messages include exact line numbers. Using |-O0| is
also a good idea, if you can tolerate the slowdown. With |-O1| line
numbers in error messages can be inaccurate, although generally speaking
running Memcheck on code compiled at |-O1| works fairly well, and the
speed improvement compared to running |-O0| is quite significant. Use of
|-O2| and above is not recommended as Memcheck occasionally reports
uninitialised-value errors which don't really exist.

But here, they only talk about uninitialised-value's and not about
invalid-reed's.


Greetings

Volker Weißmann

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

Reply via email to