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

[Bug target/13623] New: gcc seems to be allocating more space than necessary.


i have a simple test program:

typedef struct
{
 	int a,b,c,d;
 	int x[10];
} s;

void foo(void)
{ s x; }

which is compiled without any flags i.e. 'gcc -c foo.c' if i look at the
generated code, it looks like this:

 00000000 <foo>:
    0:   55                      push   %ebp
    1:   89 e5                   mov    %esp,%ebp
    3:   83 ec 48                sub    $0x48,%esp
    6:   c9                      leave  
    7:   c3                      ret    

which is 72 bytes ! where the structure size (as reported by sizeof) is 56 bytes
only.

thank you
kind regards
anupam

here is the output from gcc -v :

Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/specs
Configured with: /var/tmp/portage/gcc-3.2.3-r2/work/gcc-3.2.3/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.2
--includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2/info --enable-shared
--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib
--enable-languages=c,c++,f77,objc,java --enable-threads=posix --enable-long-long
--disable-checking --enable-cstdio=stdio --enable-clocale=generic
--enable-__cxa_atexit --enable-version-specific-runtime-libs
--with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/include/g++-v3
--with-local-prefix=/usr/local --enable-shared --enable-nls
--without-included-gettext
Thread model: posix
gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r2, propolice)
 /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/cc1 -lang-c -v -D__GNUC__=3
-D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=3 -D__GXX_ABI_VERSION=102 -D__ELF__
-Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__
-D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386
-Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__
ds.c -quiet -dumpbase ds.c -version -o /tmp/ccbdcwDA.s
GNU CPP version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r2, propolice) (cpplib)
(i386 Linux/ELF)
GNU C version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r2, propolice)
(i686-pc-linux-gnu)
        compiled by GNU C version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r2,
propolice).

-- 
           Summary: gcc seems to be allocating more space than necessary.
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anupamk at speakeasy dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: gcc version 3.2.3 20030422
  GCC host triplet: i686 Intel(R) Pentium(R) 4 CPU
GCC target triplet: x86 intel


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13623


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