This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
-fPIC changes sizeof class
- From: "Alan M. Carroll" <amc at network-geographics dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 07 Aug 2009 11:56:38 -0500
- Subject: -fPIC changes sizeof class
I have chased down a crash in my code to -fPIC changing the size of a class. My overall project uses some static libraries which are compiled without -fPIC and some dynamic libraries that use -fPIC. The effect is that if I use a template class in a static library and a dynamic library that links to the static library, I have to compile the static library with -fPIC as well. According to the documentation[1] this flag shouldn't have any effect at all because I am building for 64 bit Intel.
My question is, is this expected behavior? Or should I try to get a smaller example that demonstrates the problem?
gcc 4.3.3, x86-64, Fedora Core 10. The class and its members both have a lot of inherited zero-size classes.
[1] http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Code-Gen-Options.html#Code-Gen-Options