Package: ode
Severity: normal
Tags: patch

When building 'ode' on amd64 with gcc-4.0,
I get the following error:

OPCODE/OPC_AABBTree.cpp: In member function 'bool 
Opcode::AABBTreeNode::Subdivide(Opcode::AABBTreeBuilder*)':
OPCODE/OPC_AABBTree.cpp:295: error: cast from 'Opcode::AABBTreeNode*' to 
'udword' loses precision
OPCODE/OPC_AABBTree.cpp:309: error: cast from 'Opcode::AABBTreeNode*' to 
'udword' loses precision
OPCODE/OPC_AABBTree.h: In constructor 'Opcode::AABBTree::AABBTree()':
OPCODE/OPC_AABBTree.h:134: warning: 'Opcode::AABBTree::mTotalNbNodes' will be 
initialized after
OPCODE/OPC_AABBTree.h:132: warning:   'Opcode::AABBTreeNode* 
Opcode::AABBTree::mPool'
OPCODE/OPC_AABBTree.cpp:373: warning:   when initialized here
make[1]: *** [OPCODE/OPC_AABBTree.o] Error 1
make[1]: Leaving directory `/ode-0.5'
make: *** [build-stamp] Error 2

With the attached patch 'ode' can be compiled
on amd64 using gcc-4.0.

Regards
Andreas Jochens

diff -urN ../tmp-orig/ode-0.5/OPCODE/OPC_AABBTree.cpp ./OPCODE/OPC_AABBTree.cpp
--- ../tmp-orig/ode-0.5/OPCODE/OPC_AABBTree.cpp 2003-07-01 08:58:47.000000000 
+0200
+++ ./OPCODE/OPC_AABBTree.cpp   2005-03-03 16:39:52.000000000 +0100
@@ -290,11 +290,11 @@
                AABBTreeNode* Pool = (AABBTreeNode*)builder->mNodeBase;
                udword Count = builder->GetCount() - 1; // Count begins to 1...
                // Set last bit to tell it shouldn't be freed ### pretty ugly, 
find a better way. Maybe one bit in mNbPrimitives
-               ASSERT(!(udword(&Pool[Count+0])&1));
-               ASSERT(!(udword(&Pool[Count+1])&1));
-               mPos = udword(&Pool[Count+0])|1;
+               ASSERT(!(long(&Pool[Count+0])&1));
+               ASSERT(!(long(&Pool[Count+1])&1));
+               mPos = long(&Pool[Count+0])|1;
 #ifndef OPC_NO_NEG_VANILLA_TREE
-               mNeg = udword(&Pool[Count+1])|1;
+               mNeg = long(&Pool[Count+1])|1;
 #endif
        }
        else
@@ -306,7 +306,7 @@
 #else
                AABBTreeNode* PosNeg = new AABBTreeNode[2];
                CHECKALLOC(PosNeg);
-               mPos = (udword)PosNeg;
+               mPos = (long)PosNeg;
 #endif
        }
 
diff -urN ../tmp-orig/ode-0.5/OPCODE/OPC_HybridModel.cpp 
./OPCODE/OPC_HybridModel.cpp
--- ../tmp-orig/ode-0.5/OPCODE/OPC_HybridModel.cpp      2003-07-01 
08:58:47.000000000 +0200
+++ ./OPCODE/OPC_HybridModel.cpp        2005-03-03 16:40:13.000000000 +0100
@@ -209,7 +209,7 @@
                                Data->mLeaves[Data->mNbLeaves] = 
*current->GetAABB();
 
                                // Setup leaf data
-                               udword Index = 
(udword(current->GetPrimitives()) - udword(Data->mBase))/sizeof(udword);
+                               udword Index = (long(current->GetPrimitives()) 
- long(Data->mBase))/sizeof(udword);
                                
Data->mTriangles[Data->mNbLeaves].SetData(current->GetNbPrimitives(), Index);
 
                                Data->mNbLeaves++;
diff -urN ../tmp-orig/ode-0.5/OPCODE/OPC_OptimizedTree.cpp 
./OPCODE/OPC_OptimizedTree.cpp
--- ../tmp-orig/ode-0.5/OPCODE/OPC_OptimizedTree.cpp    2003-07-01 
08:58:47.000000000 +0200
+++ ./OPCODE/OPC_OptimizedTree.cpp      2005-03-03 16:44:51.360640448 +0100
@@ -119,7 +119,7 @@
                udword PosID = current_id++;    // Get a new id for positive 
child
                udword NegID = current_id++;    // Get a new id for negative 
child
                // Setup box data as the forthcoming new P pointer
-               linear[box_id].mData = (udword)&linear[PosID];
+               linear[box_id].mData = (long)&linear[PosID];
                // Make sure it's not marked as leaf
                ASSERT(!(linear[box_id].mData&1));
                // Recurse with new IDs
@@ -172,7 +172,7 @@
                // Get a new id for positive child
                udword PosID = current_id++;
                // Setup box data
-               linear[box_id].mPosData = (udword)&linear[PosID];
+               linear[box_id].mPosData = (long)&linear[PosID];
                // Make sure it's not marked as leaf
                ASSERT(!(linear[box_id].mPosData&1));
                // Recurse
@@ -193,7 +193,7 @@
                // Get a new id for negative child
                udword NegID = current_id++;
                // Setup box data
-               linear[box_id].mNegData = (udword)&linear[NegID];
+               linear[box_id].mNegData = (long)&linear[NegID];
                // Make sure it's not marked as leaf
                ASSERT(!(linear[box_id].mNegData&1));
                // Recurse
@@ -550,8 +550,8 @@
        if(!(Data&1))                                                           
                                        \
        {                                                                       
                                                        \
                /* Compute box number */                                        
                                \
-               udword Nb = (Data - udword(Nodes))/Nodes[i].GetNodeSize();      
\
-               Data = udword(&mNodes[Nb]);                                     
                                \
+               long Nb = (Data - long(Nodes))/Nodes[i].GetNodeSize();  \
+               Data = long(&mNodes[Nb]);                                       
                                \
        }                                                                       
                                                        \
        /* ...remapped */                                                       
                                        \
        mNodes[i].member = Data;
diff -urN ../tmp-orig/ode-0.5/OPCODE/OPC_SweepAndPrune.cpp 
./OPCODE/OPC_SweepAndPrune.cpp
--- ../tmp-orig/ode-0.5/OPCODE/OPC_SweepAndPrune.cpp    2003-07-01 
08:58:47.000000000 +0200
+++ ./OPCODE/OPC_SweepAndPrune.cpp      2005-03-03 16:45:50.795168488 +0100
@@ -164,7 +164,7 @@
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 inline_ void Remap(SAP_Element*& element, udword delta)
 {
-       if(element)     element = (SAP_Element*)(udword(element) + delta);
+       if(element)     element = (SAP_Element*)(long(element) + delta);
 }
 
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -200,7 +200,7 @@
 
                        // Remap everything
                        {
-                               udword Delta = udword(NewElems) - 
udword(mElementPool);
+                               udword Delta = long(NewElems) - 
long(mElementPool);
 
                                for(udword i=0;i<mNbUsedElements;i++)   
Remap(NewElems[i].mNext, Delta);
                                for(udword i=0;i<mNbObjects;i++)                
Remap(mArray[i], Delta);
diff -urN ../tmp-orig/ode-0.5/ode/test/test_space.cpp ./ode/test/test_space.cpp
--- ../tmp-orig/ode-0.5/ode/test/test_space.cpp 2004-04-22 22:38:51.000000000 
+0200
+++ ./ode/test/test_space.cpp   2005-03-03 16:52:41.556883898 +0100
@@ -123,15 +123,15 @@
 
 static void nearCallback (void *data, dGeomID o1, dGeomID o2)
 {
-  int i,j;
-  i = (int) dGeomGetData (o1);
-  j = (int) dGeomGetData (o2);
+  long i,j;
+  i = (long) dGeomGetData (o1);
+  j = (long) dGeomGetData (o2);
   if (i==j)
-    printf ("collision (%d,%d) is between the same object\n",i,j);
+    printf ("collision (%ld,%ld) is between the same object\n",i,j);
   if (!good_matrix[i][j] || !good_matrix[j][i])
-    printf ("collision (%d,%d) is incorrect\n",i,j);
+    printf ("collision (%ld,%ld) is incorrect\n",i,j);
   if (test_matrix[i][j] || test_matrix[j][i])
-    printf ("collision (%d,%d) reported more than once\n",i,j);
+    printf ("collision (%ld,%ld) reported more than once\n",i,j);
   test_matrix[i][j] = 1;
   test_matrix[j][i] = 1;
 }


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to