This is the mail archive of the gcc-help@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]

solaris inheritance issue




Hi, I just recently happened upon an oddity in gcc when compiling a simple
inheritance tree. 

I had been using gcc version 2.95.2 19991024 (release) and just tried gcc
version 2.95.3 20010125 (prerelease) to see if anything has changed, but same
situation occurs. 

Say we have test.cc file:

#include <stdio.h>
class foo {
};

class mefoo : foo {
  double foo;
};

int main() {
   mefoo tmp;
   printf("%d",sizeof(tmp));
}

on linux with gcc-2.95.2 i get a size of 8
on solaris with sunsoft 5.0 compilers i get a size of 8.

This is what i expect.  but...

on solaris with gcc-2.95.2 i get a size of 16 ??

If i get rid of the inheritance of mefoo from foo, then gcc on solaris reports
the size as being 8.  So i'm confused. For some reason the inheritance makes
the size go from 8 to 16.  I tried poking around and seeing what was going on,
but didn't really know what i was looking for.

Has anyone see this or has a theory?  It's strange since the sunsoft 5.0
compiler deals with this the way i expect. Thanks.

Alan

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/


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