Hi,
I got a run-time error of a Open MPI C++ program.
The following output is from gdb:
--------------------------------------------------------------------------Program
received signal SIGSEGV, Segmentation fault.0x00002aaaab3b0b81 in
opal_memory_ptmalloc2_int_malloc () from
/opt/openmpi-1.3.4-gnu/lib/libopen-pal.so.0
At the point
Breakpoint 9, Index::Index (this=0x7fffffffcb80) at src/index.cpp:2020
Name(0) {}
The Index has been called before this point and no
problem:-------------------------------------------------------Breakpoint 9,
Index::Index (this=0x117d800) at src/index.cpp:2020 Name(0)
{}(gdb) cContinuing.
Breakpoint 9, Index::Index (this=0x117d860) at src/index.cpp:2020
Name(0) {}(gdb)
cContinuing.----------------------------------------------------------------------------
It seems that the 0x7fffffffcb80 address is a problem.
But, I donot know the reason and how to remove the bug.
Any help is really appreciated.
thanks
the following is the index definition.
---------------------------------------------------------class Index {
public: Index(); Index(const Index& rhs); ~Index();
Index& operator=(const Index& rhs); vector<int>
GetPosition() const; vector<int> GetColumn() const;
vector<int> GetYear() const; vector<string> GetName() const;
int GetPosition(const int idx) const; int GetColumn(const int idx)
const; int GetYear(const int idx) const; string
GetName(const int idx) const; int GetSize() const;
void Add(const int idx, const int col, const string& name);
void Add(const int idx, const int col, const int year, const string& name);
void Add(const int idx, const Step& col, const string& name);
void WriteFile(const char* fileinput) const; private:
vector<int> Position; vector<int> Column; vector<int>
Year; vector<string> Name;};// Contructors and destructor for the
Index classIndex::Index() : Position(0), Column(0), Year(0),
Name(0) {}
Index::Index(const Index& rhs) : Position(rhs.GetPosition()),
Column(rhs.GetColumn()), Year(rhs.GetYear()), Name(rhs.GetName()) {}
Index::~Index() {}
Index& Index::operator=(const Index& rhs) { Position = rhs.GetPosition();
Column = rhs.GetColumn(), Year = rhs.GetYear(), Name = rhs.GetName();
return *this;}----------------------------------------------------------