Commit 8e1a9cd1 authored by unknown's avatar unknown

ndb -

  fix ndb-violations of strict aliasing found by gcc4.1
  (crashes in ndb_dd_*)


storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Fix strict-aliasing
storage/ndb/src/kernel/vm/KeyTable2Ref.hpp:
  Fix strict-aliasing
storage/ndb/src/kernel/vm/Pool.hpp:
  Fix strict-aliasing
parent 3ba0b6e0
...@@ -7295,7 +7295,7 @@ void Dbdict::execGET_TABINFOREQ(Signal* signal) ...@@ -7295,7 +7295,7 @@ void Dbdict::execGET_TABINFOREQ(Signal* signal)
if(objEntry->m_tableType==DictTabInfo::Datafile) if(objEntry->m_tableType==DictTabInfo::Datafile)
{ {
jam(); jam();
GetTabInfoReq *req= (GetTabInfoReq*)signal->theData; GetTabInfoReq *req= (GetTabInfoReq*)signal->getDataPtrSend();
req->senderData= c_retrieveRecord.retrievePage; req->senderData= c_retrieveRecord.retrievePage;
req->senderRef= reference(); req->senderRef= reference();
req->requestType= GetTabInfoReq::RequestById; req->requestType= GetTabInfoReq::RequestById;
...@@ -7307,7 +7307,7 @@ void Dbdict::execGET_TABINFOREQ(Signal* signal) ...@@ -7307,7 +7307,7 @@ void Dbdict::execGET_TABINFOREQ(Signal* signal)
else if(objEntry->m_tableType==DictTabInfo::LogfileGroup) else if(objEntry->m_tableType==DictTabInfo::LogfileGroup)
{ {
jam(); jam();
GetTabInfoReq *req= (GetTabInfoReq*)signal->theData; GetTabInfoReq *req= (GetTabInfoReq*)signal->getDataPtrSend();
req->senderData= c_retrieveRecord.retrievePage; req->senderData= c_retrieveRecord.retrievePage;
req->senderRef= reference(); req->senderRef= reference();
req->requestType= GetTabInfoReq::RequestById; req->requestType= GetTabInfoReq::RequestById;
......
...@@ -32,19 +32,33 @@ public: ...@@ -32,19 +32,33 @@ public:
bool find(Ptr<T>& ptr, Uint32 key) const { bool find(Ptr<T>& ptr, Uint32 key) const {
U rec; U rec;
rec.key = key; rec.key = key;
return m_ref.find(*(Ptr<U>*)&ptr, rec); Ptr<U> tmp;
bool ret = m_ref.find(tmp, rec);
ptr.i = tmp.i;
ptr.p = static_cast<T*>(tmp.p);
return ret;
} }
bool seize(Ptr<T> & ptr) { bool seize(Ptr<T> & ptr) {
return m_ref.seize(*(Ptr<U>*)&ptr); Ptr<U> tmp;
bool ret = m_ref.seize(tmp);
ptr.i = tmp.i;
ptr.p = static_cast<T*>(tmp.p);
return ret;
} }
void add(Ptr<T> & ptr) { void add(Ptr<T> & ptr) {
m_ref.add(*(Ptr<U>*)&ptr); Ptr<U> tmp;
tmp.i = ptr.i;
tmp.p = static_cast<U*>(ptr.p);
m_ref.add(tmp);
} }
void release(Ptr<T> & ptr) { void release(Ptr<T> & ptr) {
m_ref.release(*(Ptr<U>*)&ptr); Ptr<U> tmp;
tmp.i = ptr.i;
tmp.p = static_cast<U*>(ptr.p);
m_ref.release(tmp);
} }
}; };
......
...@@ -324,7 +324,10 @@ inline ...@@ -324,7 +324,10 @@ inline
void void
RecordPool<T, P>::release(Ptr<T> ptr) RecordPool<T, P>::release(Ptr<T> ptr)
{ {
m_pool.release(*(Ptr<void>*)&ptr); Ptr<void> tmp;
tmp.i = ptr.i;
tmp.p = ptr.p;
m_pool.release(tmp);
} }
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment