Discussion:
[gdal-dev] gnu g++ v11 -fanalyzer - possibly NULL operator new
Andrew C Aitchison
2021-05-15 12:24:22 UTC
Permalink
Ubuntu 21.04 has the option of the gcc-11 compiler suite.
Although not ready for production use on C++ code*,
it includes a static analyzer with the option '-fanalyzer'.

Out of curiosity I tried using this option when building the geotiff
driver for 3.3.0; command line and output attempting to build cogdriver.lo
available at
https://www.aitchison.me.uk/GDAL/make.cogdriver.errlog.gcc-fanalyzer.20210515
(terminal colour escape codes may be mangled).

Sadly my C++ isn't up to figuring out whether the analyzer is finding
bugs in the code or the code is finding bugs in the analyzer.

* https://developers.redhat.com/blog/2021/01/28/static-analysis-updates-in-gcc-11#what_s_next_for_gcc_11_and__fanalyzer
--
Andrew C. Aitchison Kendal, UK
***@aitchison.me.uk
Even Rouault
2021-05-15 13:01:28 UTC
Permalink
Andrew,

this is definitely not production ready for C++.

It reports that "auto poDriver = new GDALCOGDriver();" could return
NULL, which is obviously wrong.

Even
Post by Andrew C Aitchison
Ubuntu 21.04 has the option of the gcc-11 compiler suite.
Although not ready for production use on C++ code*,
it includes a static analyzer with the option '-fanalyzer'.
Out of curiosity I tried using this option when building the geotiff
driver for 3.3.0; command line and output attempting to build
cogdriver.lo available at
https://www.aitchison.me.uk/GDAL/make.cogdriver.errlog.gcc-fanalyzer.20210515
(terminal colour escape codes may be mangled).
Sadly my C++ isn't up to figuring out whether the analyzer is finding
bugs in the code or the code is finding bugs in the analyzer.
*
https://developers.redhat.com/blog/2021/01/28/static-analysis-updates-in-gcc-11#what_s_next_for_gcc_11_and__fanalyzer
--
http://www.spatialys.com
My software is free, but my time generally not.
Loading...