This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13312] New: C++ produces stack frame damaging code for Coldfire
- From: "Steve at Zook dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Dec 2003 06:31:28 -0000
- Subject: [Bug c++/13312] New: C++ produces stack frame damaging code for Coldfire
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Under unclear circumstances, some functions cause code to copy function
parameters to local area of stack frame. Parameters are copied at declared size
(unsigned short gets 2 bytes). If parameters are modified in function body,
emitted code may use a long (4 byte) mode directly to the copied parameter in
the local stack frame. I have an example from a fragment of the lwIP TCP/IP
source that causes the problem. An unsigned short parameter was copied to -2(%
a6) and then later in the function an add.l %d1,-2(%a6) was emitted to perform
a ++ operation on the parameter. This blows %a6 when the function returns and
crashes the code. This particular instance only occurs when -O2 is used and
only on Coldfire targets. On other m68k family processors, an add.w %d1,-2(%a6)
is generated instead which works OK. With lower optimization levels, the code
loads the value into a register, modifies it, and stores it with a move.w %d1,-2
(%a6). It is possible that this bug relates to bug #8309. I have a file
tcpout2.ii (which I can provide) that demonstrates the problem. My host and
build system is Cygwin under Win 2000. My command line is: m68k-elf-gcc -m5200 -
O2 -S tcpout2.ii
--
Summary: C++ produces stack frame damaging code for Coldfire
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Steve at Zook dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-cygwin
GCC host triplet: i686-pc-cygwin
GCC target triplet: m68k-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13312