basically, I wrote a class with another class array atributte inside, I mean:
class MyClass
{
unsigned long long x_;
bool y_;
public:
MyClass & operator=(const MyClass & mc)
{
x_ = mc.x_;
y_ = mc.y_;
return *this;
}
};
class MyOtherClass
{
MyClass myClass_[9];
public:
MyOtherClass & operator=(const MyOtherClass & mc)
{
for (unsigned int i = 0; i < 9; i++)
{
myClass_[i] = mc.myClass_[i];
}
return *this;
}
};
all of this implemented in a shared library.
I use second class in a second library like:
void ThridClass::foo( )
{
MyOtherClass c1;
MyOtherClass c2;
c1 = c2;
}
in a 64bit compilation mode with xlC_7, with no alignment pragmas, no optimization, non virtual
functions, etc, running on an Aix system.
These are the compiler options I used in both libraries:
-q64 -bernotok -g -M -qflag=i:w
and these are linker options:
-brtl -bernotok -G
When I debug the program using dbx and ask for c1.myClass_[0]
address I got one value. But, if I strace the execution inside MyOtherClass.operator=()
function, I get another address for this attribute pointer.
(dbx) p &c1.myClass_[0]
0x0ffffffffffe6a20
(dbx) s
stopped in operator=(const MyOtherClass &)
(dbx) p &myClass_[0]
0x0ffffffffffe69c0
This problem doesn't apperar on Linux and works fine.
Any idea?