public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13312] New: C++ produces stack frame damaging code for Coldfire
@ 2003-12-05  6:31 Steve at Zook dot com
  2003-12-05  6:34 ` [Bug c++/13312] " Steve at Zook dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Steve at Zook dot com @ 2003-12-05  6:31 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-06-10  8:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-05  6:31 [Bug c++/13312] New: C++ produces stack frame damaging code for Coldfire Steve at Zook dot com
2003-12-05  6:34 ` [Bug c++/13312] " Steve at Zook dot com
2003-12-05  6:39 ` [Bug target/13312] " pinskia at gcc dot gnu dot org
2004-01-18 17:55 ` [Bug target/13312] [m68k] " dhazeghi at yahoo dot com
2004-01-19  5:05 ` bernie at develer dot com
2004-01-21 17:00 ` dhazeghi at yahoo dot com
2004-01-24  7:08 ` Steve at Zook dot com
2004-01-25  5:01 ` Steve at Zook dot com
2004-01-25  9:59 ` bernie at develer dot com
2004-01-29  3:31 ` dhazeghi at yahoo dot com
2004-01-29 13:38 ` bernie at develer dot com
2004-06-10  8:03 ` bernie at develer dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).