-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Warnings compiling with g++-11.1.0 #8129
Description
I get a couple of warnings when compiling ROOT master/1f1e9b802e with g++-11.1.0, some of which sound serious and might need to be addressed.
Here is what I ran on the machine titanx in my working copy:
git checkout 1f1e9b802e
mkdir _build
cd _build
CXX=g++11.1.0 cmake ..
make -j16
There are a lot of deprecation warnings in cppyy, which, after consulting @eguiraud, seem to be known.
Here are some examples of g++'s output. I have not checked whether these are false positives, but in case they are, maybe we can suppress the warnings locally:
/home/bgruber/root/io/io/src/TStreamerInfo.cxx: In member function ‘virtual void TStreamerInfo::BuildCheck(TFile*, Bool_t)’:
/home/bgruber/root/io/io/src/TStreamerInfo.cxx:1112:29: warning: ‘this’ pointer is null [-Wnonnull]
1112 | Warning("BuildCheck", "\n\
| ~~~~~~~^~~~~~~~~~~~~~~~~~~
1113 | The StreamerInfo from %s does not match existing one (%s:%d)\n\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1114 | The existing one has not been used yet and will be discarded.\n\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1115 | Reading should work properly, however writing object of\n\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1116 | type %s will not work properly. Most likely the version number\n\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1117 | of the class was not properly updated [See ClassDef(%s,%d)].",
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1118 | file->GetName(), GetName(), fClassVersion, GetName(), GetName(), fClassVersion);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bgruber/root/net/davix/src/RRawFileDavix.cxx: In member function ‘virtual void ROOT::Internal::RRawFileDavix::ReadVImpl(ROOT::Internal::RRawFile::RIOVec*, unsigned int)’:
/home/bgruber/root/net/davix/src/RRawFileDavix.cxx:104:37: warning: ‘<unknown>’ may be used uninitialized [-Wmaybe-uninitialized]
104 | auto ret = fFileDes->pos.preadVec(fFileDes->fd, in, out, nReq, &davixErr);
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/davix/davix.hpp:70,
from /home/bgruber/root/net/davix/src/RRawFileDavix.cxx:19:
/usr/include/davix/file/davposix.hpp:353:17: note: by argument 3 of type ‘const Davix::DavIOVecInput*’ to ‘dav_ssize_t Davix::DavPosix::preadVec(DAVIX_FD*, const Davix::DavIOVecInput*, Davix::DavIOVecOuput*, dav_size_t, Davix::DavixError**)’ declared here
353 | dav_ssize_t preadVec(DAVIX_FD* fd, const DavIOVecInput * input_vec,
| ^~~~~~~~
/home/bgruber/root/graf2d/x11/src/GX11Gui.cxx:182:14: warning: ‘void operator delete(void*, std::size_t)’ called on a pointer to an unallocated object ‘1’ [-Wfree-nonheap-object]
182 | delete kil;
| ^~~
[ 79%] Linking CXX shared
A few shading warnings, where a parameter name shadows a global variable in the python headers.
In member function ‘T TF1::operator()(const T*, const Double_t*) [with T = double]’,
inlined from ‘virtual Double_t TF2::FindMinMax(Double_t*, Bool_t) const’ at /home/bgruber/root/hist/hist/src/TF2.cxx:374:23:
/home/bgruber/root/hist/hist/inc/TF1.h:764:18: warning: ‘xx’ may be used uninitialized [-Wmaybe-uninitialized]
764 | return EvalPar(x, params);
| ~~~~~~~^~~~~~~~~~~
/home/bgruber/root/hist/hist/inc/TF1.h: In member function ‘virtual Double_t TF2::FindMinMax(Double_t*, Bool_t) const’:
/home/bgruber/root/hist/hist/inc/TF1.h:764:18: note: by argument 2 of type ‘const Double_t*’ {aka ‘const double*’} to ‘Double_t (TF1::)(const Double_t*, const Double_t*)’ {aka ‘double (TF1::)(const double*, const double*)’}
/home/bgruber/root/hist/hist/src/TF2.cxx:349:13: note: ‘xx’ declared here
349 | Double_t xx[2];
| ^~
/home/bgruber/root/graf2d/graf/src/TText.cxx: In member function ‘virtual void TText::Copy(TObject&) const’:
/home/bgruber/root/graf2d/graf/src/TText.cxx:117:72: warning: ‘void operator delete(void*, std::size_t)’ called on pointer ‘obj’ with nonzero offset 112 [-Wfree-nonheap-object]
117 | delete reinterpret_cast<std::wstring*>(&((TText&)obj).fWcsTitle);
| ^
/home/bgruber/root/geom/geom/src/TGeoManager.cxx:521:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
521 | if (fHashVolumes) fHashVolumes->Clear("nodelete"); SafeDelete(fHashVolumes);
| ^~
...
/home/bgruber/root/core/foundation/inc/ROOT/RConfig.hxx:534:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
534 | # define SafeDelete(p) { if (p) { delete p; p = 0; } }
| ^
Several may be used uninitialized warnings in /home/bgruber/root/graf2d/asimage/src/TASImage.cxx and /home/bgruber/root/gui/gui/src/TGNumberEntry.cxx.
In function ‘char* strncpy(char*, const char*, size_t)’,
inlined from ‘TGTextLine::TGTextLine(const char*)’ at /home/bgruber/root/gui/gui/src/TGText.cxx:74:14:
/usr/include/bits/string_fortified.h:95:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output truncated before terminating nul copying as many bytes from a string as its length
-Wstringop-truncation]
95 | return __builtin___strncpy_chk (__dest, __src, __len,
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
96 | __glibc_objsize (__dest));
| ~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bgruber/root/gui/gui/src/TGText.cxx: In constructor ‘TGTextLine::TGTextLine(const char*)’:
/home/bgruber/root/gui/gui/src/TGText.cxx:72:23: note: length computed here
72 | fLength = strlen(string);
| ~~~~~~^~~~~~~~
/home/bgruber/root/roofit/roofitcore/src/RooAddModel.cxx: In constructor ‘RooAddModel::RooAddModel(const char*, const char*, const RooArgList&, const RooArgList&, Bool_t)’:
/home/bgruber/root/roofit/roofitcore/src/RooAddModel.cxx:125:106: warning: ‘this’ pointer is null [-Wnonnull]
125 | coutE(InputArguments) << "RooAddModel::RooAddModel(" << GetName() << ") pdf " << pdf->GetName() << " is not of type RooAbsPdf, ignored" << endl ;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Some more of these ‘this’ pointer is null.
Here is the output during the build starting from the first warning: root_g++11.1.txt