The previous implementation dereferenced a null pointer to create a
reference which would then have its address taken in the sc_bind_proxy
constructor. clang says that that uses undefined behavior, so this
change adds a default constructor which initializes the two contained
pointers to null explicitly.
We have to hope systemc code doesn't play around with sc_bind_proxy too
much and doesn't accidentally use this constructor unintentionally, but
it seems like the least bad possible solution which makes clang happy.
Change-Id: Ic59603495fe7a406586a18ce44de979f84089bcd
Reviewed-on: https://gem5-review.googlesource.com/c/13879
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
namespace sc_core
{
+sc_bind_proxy::sc_bind_proxy() : _interface(nullptr), _port(nullptr) {}
+
sc_bind_proxy::sc_bind_proxy(sc_interface &_interface) :
_interface(&_interface), _port(nullptr)
{}
_interface(nullptr), _port(&_port)
{}
-const sc_bind_proxy SC_BIND_PROXY_NUL(*(sc_port_base *)nullptr);
+const sc_bind_proxy SC_BIND_PROXY_NIL;
sc_module::~sc_module() { delete _gem5_module; }
-const sc_bind_proxy SC_BIND_PROXY_NIL(*(sc_port_base *)nullptr);
-
void
sc_module::operator () (const sc_bind_proxy &p001,
const sc_bind_proxy &p002,
sc_port_base *_port;
public:
+ sc_bind_proxy();
sc_bind_proxy(sc_interface &_interface);
sc_bind_proxy(sc_port_base &_port);