This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Question on unexpected asm output
- To: gcc at gcc dot gnu dot org
- Subject: Question on unexpected asm output
- From: Tim Oertel <toertel at rpa dot net>
- Date: Sun, 04 Mar 2001 23:53:17 -0500
Hi,
I'm examining the output from a compile and don't understand
why the assembly is being generated the way it is. A simple
example:
extern int other_foobar0( void );
extern "C" void
foobar0(void)
{
(void) other_foobar0();
}
Generates an object file, which disassembles to:
00000000 <foobar0>:
0: 83 ec 0c sub $0xc,%esp
3: e8 fc ff ff ff call 4 <foobar0+0x4>
8: 83 c4 0c add $0xc,%esp
b: c3 ret
My question is why is there the extra sub and add? I'd
expect them if I had any locals, but I don't, and the
extra stack allocated isn't even used.
I've found similar cases with more complex code where there
are unusual adds and subtracts sprinkled throughout a function.
(Including a strange 'add $0xfffffffc,%esp', rather than a sub.)
This looks strange, but the stack adjustments are all consistent,
so nothing is showing up buggy. I want to understand what is
going on, and if possible, can I turn it off.
rand# g++ -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
rand# make foo.S
g++ -mpentium -O6 -fomit-frame-pointer -c foo.c -o foo.o
objdump -CD foo.o > foo.S
Please CC: me.
Thanks for any help.
--
////// toertel@rpa.net /////////////
// "Why should I be content to simply //
/ live in this world, when I, as a //
human being, can CREATE it?" //