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

RE: GCC 3.4.3 Problem


I have discovered the cause of this problem.  It has to do with GCC 3.4.3
performing more inlining of functions.  For example:

int foo(int arg)
{
	<some variable declarations>
	...
	foo1(x);
	foo2(x);
	foo3(x);
	...
}
If the stack used at the point foo() is called is 2K, and foo1(), foo2(),
and foo3() each use 5K of stack, then with GCC 3.2.1 (no inlining) the worse
case stack used is 2K + 5K = 7K.  With GCC 3.4.3, which now inlines foo1(),
foo2(), and foo3(), the worse case stack used is 2K + 3*5K = 17K.  This is
what was drastically increasing my stack usage.

I tried using the compiler options -fkeep-inline-functions and
-fno-inline-functions, but these did not produce any different code.  I
ended up using -fno-inline for the whole source file and foregoing any
inlining in that file.

Jay

-----Original Message-----
From: Jay Foster [mailto:jay@systech.com]
Sent: Tuesday, March 01, 2005 5:26 PM
To: 'gcc-help@gcc.gnu.org'
Subject: GCC 3.4.3 Problem


I am using GCC to compile code for an arm-elf target, and have recently
changed from GCC 3.2.1 to GCC 3.4.3.  GCC is now generating a stack frame
that is about 14KB larger in one of my functions.  I have examined the code
carefully, and cannot see why this is so.

With GCC 3.2.1, the stack frame was about 1800 bytes.  With GCC 3.4.3, the
stack frame is now > 16KB.  Same source code.

Has anyone seen this kind of behavior?  I compiled the code with the '-v
-save-temps' option and examined the assembly code.  I cannot see where the
code even accesses any of the extra stack frame area.  Is there a compiler
option to generate a function stack map?

Thanks.
Jay


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