This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Use of initialized variable in strtod.c
> Does Coverity have a way in which in the code it can be marked as OK? (I'd
> expect some '#pragma CoverityIgnore(bits)' or the like ought to be
> available.)
Yes. You have to provide a modeling file. Also see the Coverity Scan
FAQ entry "what is a model" at https://scan.coverity.com/faq.
Other projects use them, like Python. See, for example,
https://docs.python.org/devguide/coverity.html.
> I agree with trying to get rid of the message, but it is worth
> bloat to do it? (It will add instructions to either initialize bits to 0 or
> add the else.)
If I am parsing things correctly, it seems like the bloat is going the
other way: if the code is not needed, then remove it. It will avoid
findings like these, and speed up the compile.
> I would rather mark something in the code as a false
> positive than add code because the tool is not smart enough to know--so we
> might differ in philosophy there.
Perhaps a better strategy would be to initialize all variables, and
then allow the optimizer to remove the unneeded writes. It will ensure
a program is in a good state, and avoid findings like these.
Another strategy is to do nothing. In this case, the same findings
will waste multiple developer's time, and generate additional mailing
list messages.
I like dark and silent cockpits, so I don't want tools generating
findings, and I don't want mailing list messages. I would squash it
once and for all and avoid all future problems. But that's just me,
and I understand the Newlib project may have a different outlook on
things.
Jeff