Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DBG_X] 'nonnull' argument 't' compared to NULL #45998

Open
iarspider opened this issue Sep 13, 2024 · 12 comments · May be fixed by #45999
Open

[DBG_X] 'nonnull' argument 't' compared to NULL #45998

iarspider opened this issue Sep 13, 2024 · 12 comments · May be fixed by #45999

Comments

@iarspider
Copy link
Contributor

In DBG_X IB, the following warning was emitted:

>> Compiling edm plugin src/RecoHGCal/TICL/plugins/filters.cc
<gcc invocation>
In file included from src/FWCore/MessageLogger/interface/ErrorObj.h:136,
                 from src/FWCore/MessageLogger/interface/MessageSender.h:5,
                 from src/FWCore/MessageLogger/interface/MessageLogger.h:30,
                 from src/RecoHGCal/TICL/plugins/TracksterLinkingbySkeletons.cc:1:
src/FWCore/MessageLogger/interface/ErrorObj.icc: In member function 'edm::ErrorObj::opltlt<bool (std::array<ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float>, ROOT::Math::DefaultCoordinateSystemTag>, 3ul> const&, std::array<ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float>, ROOT::Math::DefaultCoordinateSystemTag>, 3ul> const&, float)>(bool ( const&)(std::array<ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float>, ROOT::Math::DefaultCoordinateSystemTag>, 3ul> const&, std::array<ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float>, ROOT::Math::DefaultCoordinateSystemTag>, 3ul> const&, float))edm::ErrorObj&':
  src/FWCore/MessageLogger/interface/ErrorObj.icc:28:10: warning: 'nonnull' argument 't' compared to NULL [-Wnonnull-compare]
    28 |     myOs << t;
      |     ~~~~~^~~~

full log

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 13, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

A new Issue was created by @iarspider.

@Dr15Jones, @antoniovilela, @makortel, @mandrenguyen, @rappoccio, @sextonkennedy, @smuzaffar can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@makortel
Copy link
Contributor

assign core

Let's start with this even if I believe the problem is not in the MessageLogger code

@cmsbuild
Copy link
Contributor

New categories assigned: core

@Dr15Jones,@makortel,@smuzaffar you have been requested to review this Pull request/Issue and eventually sign? Thanks

@makortel
Copy link
Contributor

The referred MessageLogger code is

template <class T>
ErrorObj& ErrorObj::opltlt(const T& t) {
myOs.str(emptyString);
myOs << t;

I guess the comparison wrt. NULL comes somewhere in the std::ostringstream::operator<<()?

The warning was emitted when compiling https://github.com/cms-sw/cmssw/blob/master/RecoHGCal/TICL/plugins/TracksterLinkingbySkeletons.cc . I didn't see any indication on the log about the line in TracksterLinkingbySkeletons.cc. Since the warning is specific to DBG_X, I guess the culprit needs to be a LogDebug / LogTrace trace (well, the file uses only LogDebug).

Another hint is the instantiation of ErrorObj::opltlt(), which points towards std::array<ticl::Vector, 3> being printed (ticl::Vector is a type alias for math::XYZVectorF). On a quick look I did not, however, see where std::array<ticl::Vector, 3> would be passed to LogDebug.

@Dr15Jones
Copy link
Contributor

So the error message is weird as it says the type of T is a function

bool (std::array<ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float>, ROOT::Math::DefaultCoordinateSystemTag>, 3ul> const&, std::array<ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float>, ROOT::Math::DefaultCoordinateSystemTag>, 3ul> const&, float)

@makortel
Copy link
Contributor

Good catch! I guess the offending line is the second line in
https://github.com/cms-sw/cmssw/blob/6e31ebe803aa3cd54ba56999036e36202a849dbc/RecoHGCal/TICL/plugins/TracksterLinkingbySkeletons.cc#L306-307
that should be

          LogDebug("TracksterLinkingbySkeletons") << "Two Points are in Cylinder  " << isInCyl << std::endl;

@Dr15Jones
Copy link
Contributor

Found it

LogDebug("TracksterLinkingbySkeletons") << "Two Points are in Cylinder " << isInCylinder << std::endl;

the FUNCTION isInCylinder is being passed to LogDebug, not the return value of the function.

@makortel
Copy link
Contributor

Hopefully fixed in #45999

@makortel
Copy link
Contributor

assign RecoHGCal/TICL

(mostly for completeness)

@makortel
Copy link
Contributor

+core

Core part is done

@cmsbuild
Copy link
Contributor

New categories assigned: reconstruction,upgrade

@jfernan2,@mandrenguyen,@srimanob,@subirsarkar you have been requested to review this Pull request/Issue and eventually sign? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants