inheritance issue - solaris - simple testcase

Alan Gonzalez agonzalez@yahoo.com
Tue Feb 6 03:31:00 GMT 2001


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 ??

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.

Can someone explain this one to me?   Thanks.

Alan

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/


More information about the Gcc-bugs mailing list