Porting issue from 32-bit to 64 bit

Shashank Ghoti shashank.ghoti at gmail.com
Thu Jan 5 11:00:59 UTC 2012


Hi All,

We are porting the application from 32-Bit to 64 Bit and OS is also 64-Bit
. All the processes are highly generating core dump because of align
problem when we go to 64 bit.

We have run processes using  GDB and found the below problem.

Let's say the class
class demo
{
    private:
         int a;
        char *ptr;
         int b;
};

GDB shows the object size created is 16 bytes ( 16 bytes memory creation in
HEAP)while we go inside the class constructor, the size is shown of the
"This pointer" is 24 for this kind of class defined. We think that the
problem is due to alignment.

The problem has gone away if we re-define the class as:
class demo
{
     private:
         char *ptr;
         int a;
         int b;
};

But we have many processes and there are lot of files. So it would be
taking a lot of time to manually fix it.
Are we missing any compiler flag? OR how to fix it?  We have been trying
find out since last two weeks? We don't know.


Thanks
Shashank
Senior Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20120105/7fd4fd17/attachment.html>


More information about the ubuntu-users mailing list