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] |
I found that g++ 3.3, 3.4 and 3.5 have different class layout for the following testcase: struct A {char a;}; struct B: virtual public A {}; struct C:public B{ int c; virtual void f() {}; }; struct D { char d; }; struct E {int:3;}; struct F: public C, virtual E, public D { char f1; virtual void f(){} }; int main() {F f;} g++ 3.3's information is: Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada --disable-checking --libdir=/usr/lib --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --host=powerpc-suse-linux --build=powerpc-suse-linux --target=powerpc-suse-linux --enable-targets=powerpc64-suse-linux --enable-biarch Thread model: posix gcc version 3.3.3 (SuSE Linux) g++3.4's information is: Configured with: ../gcc/configure --prefix=/.../torolab.ibm.com/fs/projects/vabld/run/gcc/linux_ppc/3.4-dev --enable-languages=c,c++,f77,objc --enable-altivec --enable-shared powerpc-suse-linux Thread model: posix gcc version 3.4.0 20040212 (prerelease) g++ 3.5's information is: Configured with: /private/var/tmp/gcc/gcc-1765.obj~1/src/configure --disable-checking --prefix=/usr --disable-libmudflap --mandir=/share/man --enable-languages=c,objc,c++ --disable-libada --program-transform-name=/^[cg][^+.-]*$/s/$/-3.5/ --with-gxx-include-dir=/include/gcc/darwin/3.5/c++ --build=powerpc-apple-darwin --host=powerpc-apple-darwin --target=powerpc-apple-darwin Thread model: posix gcc version 3.5.0-tree-ssa 20040321 (merged 20040529) (Apple Computer, Inc. build 1765) Attached files are the class and vft layout results with three g++ compilers using -fdump-class-hierarchy option. (See attached file: temp4.g++35.class)(See attached file: temp4.g++33.class)(See attached file: temp4.C.g++34_32.class) For the virtual base class A in the class F's layout, I thought tail padding rule should only apply to non-virtual base classes. Before mapping the virtual base class A, the current class size should be increased to the mutiplication of alignment ( which is 4 at this moment), and A should be put at offset 12 rather at offset 10. I understant that C++ ABI does not explicitly specify the tail padding rule. I would like to take this opportunity to understand the tail padding rules and empty base class mapping strategies you are using. Your kind help is highly appreciated. Thanks. Yan Liu email: yanliu@ca.ibm.com
Attachment:
temp4.g++35.class
Description: Binary data
Attachment:
temp4.g++33.class
Description: Binary data
Attachment:
temp4.C.g++34_32.class
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |