> Is this segmentation fault at compile time or at run-time? I believe it was > a segfault at run-time due to a miscompile.
Yes, it's a segfault at run-time. These source codes produce wrong object files. > Possibly. Can you split the .cpp files such that you only compile a single > function with graphite and that compiling this function causes the > miscompile. This allows us to look at less code. I've tried to reduce btCollisionWorld.cpp and btCollisionDispatcher.cpp (They can be found attached). Should we ask Sven? -- Cheers, Roman Gareev.
void *btAlignedAlloc (int size, int alignment); template <typename T, unsigned Alignment> class btAlignedAllocator { typedef btAlignedAllocator< T, Alignment> self_type; public: T *allocate (int n, const T** hint = 0) { (void) hint; return reinterpret_cast<T*>(btAlignedAlloc(sizeof (T) * n, Alignment)); } }; #include <new> template <typename T> class btAlignedObjectArray { btAlignedAllocator<T, 16> m_allocator; int m_size; T *m_data; public: void push_back () { T *s = (T*) m_allocator.allocate (m_size * 2); int i; for (i=0; i<m_size; ++i) new (&s[i]) T (m_data[i]); } }; class btCollisionDispatcher { btAlignedObjectArray<btCollisionDispatcher*> m_manifoldsPtr; virtual void getNewManifold (); }; void btCollisionDispatcher::getNewManifold () { m_manifoldsPtr.push_back (); }
void* btAlignedAlloc (int size, int alignment); template <typename T, unsigned Alignment> class btAlignedAllocator { typedef btAlignedAllocator<T, Alignment> self_type; public: template <typename Other> btAlignedAllocator (const btAlignedAllocator<Other, Alignment>& ) {} T *allocate (int n, const T **hint = 0) { (void) hint; return reinterpret_cast<T*> (btAlignedAlloc (sizeof (T) * n , Alignment)); } }; #include <new> template <typename T> class btAlignedObjectArray { btAlignedAllocator<T, 16> m_allocator; int m_size; T *m_data; public: void push_back (const T& _Val) { T *s = (T*) m_allocator.allocate (m_size * 2); int i; for (i=0; i<m_size; ++i) new (&s[i]) T (m_data[i]); new (&m_data[m_size]) T (_Val); } }; typedef btAlignedObjectArray<class btCollisionObject*> btCollisionObjectArray; class btCollisionObject; class btCollisionWorld { protected: btAlignedObjectArray<btCollisionObject*> m_collisionObjects; public: virtual void addCollisionObject(btCollisionObject* collisionObject); }; void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject) { m_collisionObjects.push_back(collisionObject); }