[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#286239: gcc-3.3: I think sizeof(struct xxx) return wrong size



Package: gcc-3.3
Version: 1:3.3.5-3
Severity: critical
Justification: causes serious data loss

try to compile and run this

//-------------------------------
#include <stdio.h>

int main()
{
struct mesaj_primire
{
        unsigned char   xf;
        unsigned char   cf;
        unsigned char   nw;
        unsigned char   nl;
        unsigned int    posx;
        unsigned int    posy;
        unsigned int    state;
        unsigned char   nwc;
        unsigned char   nlc;
        unsigned char   crc;
        unsigned short  crc16;
};
printf("%i\n",sizeof(mesaj_primire));
return 0;
}

//---------------------------------
#gcc test.cpp -lstdc++ -o test
#./test
24

24!!!! and I think is 21

I try this on my ppc laptop and my x86 desktop and the result is the same (24)

taipan:/# uname -a;gcc -v
Linux taipan 2.6.8.1 #3 Wed Oct 27 18:29:21 EEST 2004 ppc GNU/Linux
Reading specs from /usr/lib/gcc-lib/powerpc-linux/3.3.5/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc --disable-multilib powerpc-linux
Thread model: posix
gcc version 3.3.5 (Debian 1:3.3.5-3)
taipan:/#

root@taipan:/# uname -a;gcc -v
Linux taipan 2.6.4 #1 SMP Sun Sep 19 19:28:30 EEST 2004 i686 GNU/Linux
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.5 (Debian 1:3.3.5-4)
root@taipan:/#



-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: powerpc (ppc)
Kernel: Linux 2.6.8.1
Locale: LANG=ro_RO, LC_CTYPE=ro_RO (charmap=ISO-8859-2)

Versions of packages gcc-3.3 depends on:
ii  binutils                    2.15-5       The GNU assembler, linker and bina
ii  cpp-3.3                     1:3.3.5-3    The GNU C preprocessor
ii  gcc-3.3-base                1:3.3.5-3    The GNU Compiler Collection (base 
ii  libc6                       2.3.2.ds1-19 GNU C Library: Shared libraries an
ii  libgcc1                     1:3.4.3-4    GCC support library

-- no debconf information



Reply to: