[Bug target/32577] [SH] static inline attribute causes stack overflow
saito at densan dot co dot jp
gcc-bugzilla@gcc.gnu.org
Mon Jul 23 01:23:00 GMT 2007
------- Comment #2 from saito at densan dot co dot jp 2007-07-23 01:23 -------
How about following testcase.
I list the value which moves current sp as to some architectures.
In the following case, listed value is 24.
> add #-24,r15 <-- stack grows down
With the result that only gcc-4.2.0 for sh4 accumulates the stack space for
inlined variables. Actually, I need to spread the stack size for sh-linux's
kernel-thread from 0x2000 byte to 0x4000 byte, although I specify optimization
option(-O2). Gcc-4.1.2 does not have this problem.
-testcase--------------------------------------------------
struct xxx {
int x;
int y;
};
static inline __attribute__((always_inline)) int add(int x, int y)
{
struct xxx xxx;
xxx.x = x;
xxx.y = y;
dummy(&xxx);
return x + y;
}
int x, y;
main(int ac, char** av)
{
x = add(x, y); /* count of add is one */
return x;
}
-end testcase----------------------------------------------
compiling options: gcc test.c -O2 -S
case of gcc-4.2.0
-----------------------------------------------------------
count of add | 1 2 4 8 16
-------------------------------------------------------------
the value sh4 | 8 16 24 40 68
ppc | 48 64 64 64 64
i686 | 16 16 16 16 16
case of gcc-4.1.2
-----------------------------------------------------------
the value sh4 | 8 8 8 8 8
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32577
More information about the Gcc-bugs
mailing list