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 09:50: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 #16 from jakub at gcc dot gnu dot org 2008-12-19 09:50 -------
Given the sorry state of tree DSE (what we have is a joke), it is actually
trivial to come up with testcases for arbitrary pure/const call elimination
during RTL DCE. E.g.
/* 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)
__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);
a.l = 6;
}
int
main (void)
{
foo ();
return 0;
}
This segfaults on i386-linux, x86_64-linux, powerpc64-linux (-m64 only, -m32 is
fine), haven't tried other targets. For ia64-linux and other targets where
return ip is passed in a register I think we'd want to call foo from some
function that has some stuff on the stack and checks that it hasn't been
modified by the foo call.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38245