This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/38245] [4.4 Regression] stack corruption when a call is removed but not the outgoing argument pushes
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Dec 2008 10:41:55 -0000
- Subject: [Bug rtl-optimization/38245] [4.4 Regression] stack corruption when a call is removed but not the outgoing argument pushes
- References: <bug-38245-12544@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #17 from jakub at gcc dot gnu dot org 2008-12-19 10:41 -------
Better testcase:
/* PR rtl-optimization/38245 */
/* { dg-do run } */
/* { dg-options "-O2" } */
extern int bar (long, long, long, long, long, long, long, long,
long, long, long, long, long, long, long, long,
long, long, long, long, long, long, long, long,
long, long, long, long, long, long, long, long)
__attribute__((pure));
struct A { int i, j; union { short s[4]; long long l; }; char pad[512]; } a;
void __attribute__((noinline))
foo (void)
{
a.s[2] = bar (6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21);
a.l = 6;
}
int
main (void)
{
char buf[256];
int i;
for (i = 0; i < (int) sizeof buf; i++)
buf[i] = i;
asm volatile ("" : : "r" (buf) : "memory");
foo ();
asm volatile ("" : : "r" (buf) : "memory");
for (i = 0; i < (int) sizeof buf; i++)
if (buf[i] != (char) i)
__builtin_abort ();
return 0;
}
BTW, e.g. on powerpc64-linux or ia64-linux the stack arguments aren't in
CALL_INSN_FUNCTION_USAGE at all, only the register arguments.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38245