Guys,
I am getting a puzzling warning when building the latest release of simbody. Actually it only occurs when building examples, but since I am having problems downstream I think this needs to be addressed. The warning is below. Any advice?
Thanks
Sam
In file included from /Users/Sam/github/simbody/SimTKcommon/src/PrivateInstantiations.cpp:28:
In file included from /Users/Sam/github/simbody/SimTKcommon/src/../Geometry/src/PolygonalMeshImpl.h:27:
In file included from /Users/Sam/github/simbody/SimTKcommon/Geometry/include/SimTKcommon/internal/PolygonalMesh.h:27:
In file included from /Users/Sam/github/simbody/SimTKcommon/./include/SimTKcommon/Simmatrix.h:36:
In file included from /Users/Sam/github/simbody/SimTKcommon/Scalar/include/SimTKcommon/Scalar.h:42:
/Users/Sam/github/simbody/SimTKcommon/Scalar/include/SimTKcommon/internal/NTraits.h:1076:1: warning: binding dereferenced null pointer to reference has undefined behavior
[-Wnull-dereference]
SimTK_DEFINE_REAL_NTRAITS(float);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Sam/github/simbody/SimTKcommon/Scalar/include/SimTKcommon/internal/NTraits.h:982:62: note: expanded from macro 'SimTK_DEFINE_REAL_NTRAITS'
static T& imag(T&) { assert(false); return *reinterpret_cast<T*>(0); } \
^~~~~~~~~~~~~~~~~~~~~~~~
Can't figure out: binding dereferenced null pointer to reference has undefined behavior
- Samuel Flores
- Posts: 189
- Joined: Mon Apr 30, 2007 1:06 pm
- Samuel Flores
- Posts: 189
- Joined: Mon Apr 30, 2007 1:06 pm
Re: Can't figure out: binding dereferenced null pointer to reference has undefined behavior
I am building on OS 10.12 Sierra.
thanks
sam
thanks
sam
- Michael Sherman
- Posts: 806
- Joined: Fri Apr 01, 2005 6:05 pm
Re: Can't figure out: binding dereferenced null pointer to reference has undefined behavior
Hi, Sam. I think that just reflects a smarter compiler that noticed some tricky code that has always been there and is actually OK. Is the fact that there is a warning causing you trouble? We could suppress it.
Best regards,
Sherm
Best regards,
Sherm
- Christopher Dembia
- Posts: 506
- Joined: Fri Oct 12, 2012 4:09 pm
Re: Can't figure out: binding dereferenced null pointer to reference has undefined behavior
It is unlikely that your downstream problems are related to this warning. There is currently an Issue and a Pull Request on GitHub regarding this warning (https://github.com/simbody/simbody/pull/533).
- Samuel Flores
- Posts: 189
- Joined: Mon Apr 30, 2007 1:06 pm
Re: Can't figure out: binding dereferenced null pointer to reference has undefined behavior
Good to know that's not the problem. I'll continue hacking. Should I be using -std=c++14 , on simbody, openmm, and molmodel?
- Christopher Dembia
- Posts: 506
- Joined: Fri Oct 12, 2012 4:09 pm
Re: Can't figure out: binding dereferenced null pointer to reference has undefined behavior
Simbody requires C++11 features. C++14 is not required for Simbody, but I think Simbody should also compile under C++14 (this is not tested regularly). If you compile Simbody with C++11, then all code that depends on Simbody must also be compiled with C++11. I don't know about the requirements for OpenMM or MolModel.