This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mips structure padding


> Date: Mon, 28 Jan 2002 18:05:31 -0800
> From: "Todd Malsbary" <toddm@fullplaymedia.com>
> To: <gcc@gcc.gnu.org>

> hi, i have a c structure and a c++ class with the same data members
> and sizeof returns different sizes for each.  i'm wondering exactly
> why that occurs.  i'm building ecos using gcc 3.0.3 targeted for
> mips-r3000-elf.  the purpose of the c structure is to allocate some
> storage for placement new in c++ land.  i can verify that this code
> works on the arm-elf target through various versions of gcc and i'm
> assuming it works for the other mips targets that ecos runs on.  it
> seems to be confined to the r3000 target.  is this is a bug or a
> feature?  in either case, what would be the recommended fix?

Yes, this sounds like a bug report.  Be sure that the text is more
than identical.  Have:

#ifdef __cplusplus
extern "C" {
#endif

struct foo {
       ...
};

#ifdef __cplusplus
}
#endif

in a single header file, include, and that only, and include in your C
and C++ programs, and see if they are laid out the same.  After doing
that, if they differ, then file a bug report, see the documentation
for how to do that.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]