This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/20182] Improper code generation causes stack corruption
- From: "jay at systech dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Feb 2005 23:29:46 -0000
- Subject: [Bug rtl-optimization/20182] Improper code generation causes stack corruption
- References: <20050223230159.20182.jay@systech.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From jay at systech dot com 2005-02-23 23:29 -------
Subject: RE: Improper code generation causes
stack corruption
I tried the -fno-strict-aliasing option, but this generates the same code.
Although this may violate aliasing rules, the compiler is not messing up
with the '&V42Parms', but the 'Size' argument. The problem seems to me to
be:
FunctionB(int *pSize)
{
}
FunctionA(int Size)
{
FunctionB(&Size);
}
When code calls FunctionA(), it passes Size in a register. When FunctionA
tries to pass the address of Size to FunctionB(), it must first make a local
copy of Size on the stack (or somewhere in memory), so that it can take the
address of it. This is where things are going wrong.
Jay
-----Original Message-----
From: pinskia at gcc dot gnu dot org [mailto:gcc-bugzilla@gcc.gnu.org]
Sent: Wednesday, February 23, 2005 3:05 PM
To: jay@systech.com
Subject: [Bug rtl-optimization/20182] Improper code generation causes
stack corruption
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-23
23:05 -------
You are violating aliasing rules:
(uint16 *)&V42Parms
try with -fno-strict-aliasing or with an union. Please read
http://gcc.gnu.org/bugs.html which talks
about this problem.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
Status|UNCONFIRMED |RESOLVED
Component|c |rtl-optimization
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20182
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20182