[mythtv] Null pointer dereference warnings when compiling with -O3

Klaas de Waal klaas.de.waal at gmail.com
Wed Sep 23 17:58:09 UTC 2020


Hi,

I've recently started to build with "--extra-cppflags=-O3", to investigate
if incidental loss of transport stream packets can be related to runtime
performance.
To my surprise I do then get a lot of "null pointer dereference" and
"possible null pointer dereference" compilation warnings. This is with
Fedora-32 and gcc 10.2.1.

I have the impression that these warnings are just wrong.

This is for the following reasons:
- The code that is flagged runs already for years and years. If there was a
null pointer dereference I think that somebody would have noticed this. The
word "segfault" comes to the mind.
- There are several warnings about class DTVChannelInfo declared in file
dtvconfparser.h. The interesting bit is that when I change the order of the
class variables, e.g. move "QString m_name" two lines up, that some of the
"null pointer dereference" warnings disappear. This is not logical; the
order of the class members should not determine if code is valid or not. As
far as I know of course.
- When compiled with "-O3  -fno-inline" then all "null pointer
dereference"warnings but one do disappear. This is again not logical to me.
Possibly only when "-fno-inline" is given the "null pointer dereference"
warnings are correct.

Considering this I do not think it is a good idea to rewrite the code to
satisfy the compiler.

One way to deal with this is to remove the "-Wnull-dereference" option from
the standard set of compiler flags.

What I want to achieve is to build fully optimized without getting
warnings, so that if there is a warning it is something that needs to be
looked at.

Anybody an opinion on this?

Kind regards,
Klaas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20200923/1a2c4eec/attachment.htm>


More information about the mythtv-dev mailing list