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
* [Bug c++/13312] C++ produces stack frame damaging code for Coldfire
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 ` Steve at Zook dot com
2003-12-05 6:39 ` [Bug target/13312] " pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Steve at Zook dot com @ 2003-12-05 6:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From Steve at Zook dot com 2003-12-05 06:34 -------
Created an attachment (id=5283)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5283&action=view)
A C++ preprocessed source file to demonstrate the bug
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13312
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/13312] C++ produces stack frame damaging code for Coldfire
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 ` pinskia at gcc dot gnu dot org
2004-01-18 17:55 ` [Bug target/13312] [m68k] " dhazeghi at yahoo dot com
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-05 6:39 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |target
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13312
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/13312] [m68k] C++ produces stack frame damaging code for Coldfire
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 ` dhazeghi at yahoo dot com
2004-01-19 5:05 ` bernie at develer dot com
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: dhazeghi at yahoo dot com @ 2004-01-18 17:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dhazeghi at yahoo dot com 2004-01-18 17:54 -------
Bernardo, you frequently build for this target. Would you mind commenting on
this report? Thanks.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |bernie at develer dot com
Summary|C++ produces stack frame |[m68k] C++ produces stack
|damaging code for Coldfire |frame damaging code for
| |Coldfire
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13312
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/13312] [m68k] C++ produces stack frame damaging code for Coldfire
2003-12-05 6:31 [Bug c++/13312] New: C++ produces stack frame damaging code for Coldfire Steve at Zook dot com
` (2 preceding siblings ...)
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
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: bernie at develer dot com @ 2004-01-19 5:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bernie at develer dot com 2004-01-19 05:05 -------
I've tried to reproduce this problem with:
- GCC 3.4 (20040114) + Andreas cc0 patch
- GCC 3.3.3 (20031222) + my ColdFire/uClinux patch set
In both cases, the generated code seems to be correct, assuming
I'm looking at the same variable:
GCC 3.4:
move.w %d0,-2(%a6)
[...]
clr.l %d0
move.w -2(%a6),%d0
add.l %d0,88(%a5)
move.w 94(%a5),%d0
GCC 3.3.3:
move.w %d0,-6(%a6)
[...]
clr.l %d0
move.w -6(%a6),%d0
add.l %d0,88(%a4)
move.w 94(%a4),%d0
Please test with the latest 3_3-branch snapshot. If you
still see the problem, try applying all these patches in
the given order:
http://www.develer.com/uclinux/uclinux-tools-20031230/gcc-3.3.2-coldfire-targets.patch
http://www.develer.com/uclinux/uclinux-tools-20031230/gcc-3.3.2-coldfire-frame.patch
http://www.develer.com/uclinux/uclinux-tools-20031230/gcc-3.3.2-uclinux-idshlib.patch
http://www.develer.com/uclinux/uclinux-tools-20031230/gcc-3.3.2-uclinux-thunk.patch
http://www.develer.com/uclinux/uclinux-tools-20031230/gcc-3.3.2-uclinux-specs.patch
http://www.develer.com/uclinux/uclinux-tools-20031230/gcc-3.3.2-coldfire-omitfrmptr.patch
The uClinux patches are not relevant to you, but you need
them in order to apply dependent ColdFire patches.
If any of these patches fixes the problem for you, I'll prepare
a standalone version that applies to 3_3-branch and submit it
for this PR.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13312
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/13312] [m68k] C++ produces stack frame damaging code for Coldfire
2003-12-05 6:31 [Bug c++/13312] New: C++ produces stack frame damaging code for Coldfire Steve at Zook dot com
` (3 preceding siblings ...)
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
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: dhazeghi at yahoo dot com @ 2004-01-21 17:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dhazeghi at yahoo dot com 2004-01-21 17:00 -------
Stepehen, would it be possible for you to check 3.3 branch with the patches Bernie mentioned to
see if this is still present? Thanks.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13312
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/13312] [m68k] C++ produces stack frame damaging code for Coldfire
2003-12-05 6:31 [Bug c++/13312] New: C++ produces stack frame damaging code for Coldfire Steve at Zook dot com
` (4 preceding siblings ...)
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
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Steve at Zook dot com @ 2004-01-24 7:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From Steve at Zook dot com 2004-01-24 07:08 -------
gcc-3.3-20040119 both with and without Bernardo's patches produces the bug. I
shall try gcc-3.4-20040121.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13312
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/13312] [m68k] C++ produces stack frame damaging code for Coldfire
2003-12-05 6:31 [Bug c++/13312] New: C++ produces stack frame damaging code for Coldfire Steve at Zook dot com
` (5 preceding siblings ...)
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
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Steve at Zook dot com @ 2004-01-25 5:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From Steve at Zook dot com 2004-01-25 05:01 -------
I built gcc-3.4-20040121. It took a little doing because newlib-1.11.0 (the
revision I've been using) had a bunch of fatal compile errors that I had to
fixup (apperently the 3.4 compile is pickier about certain things). The same
problem persists.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13312
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/13312] [m68k] C++ produces stack frame damaging code for Coldfire
2003-12-05 6:31 [Bug c++/13312] New: C++ produces stack frame damaging code for Coldfire Steve at Zook dot com
` (6 preceding siblings ...)
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
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: bernie at develer dot com @ 2004-01-25 9:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bernie at develer dot com 2004-01-25 09:59 -------
Subject: Re: [m68k] C++ produces stack frame damaging code
for Coldfire
Steve at Zook dot com wrote:
> ------- Additional Comments From Steve at Zook dot com 2004-01-25 05:01 -------
> I built gcc-3.4-20040121. It took a little doing because newlib-1.11.0 (the
> revision I've been using) had a bunch of fatal compile errors that I had to
> fixup (apperently the 3.4 compile is pickier about certain things). The same
> problem persists.
Please submit patches to the newlib guys.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13312
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/13312] [m68k] C++ produces stack frame damaging code for Coldfire
2003-12-05 6:31 [Bug c++/13312] New: C++ produces stack frame damaging code for Coldfire Steve at Zook dot com
` (7 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: dhazeghi at yahoo dot com @ 2004-01-29 3:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dhazeghi at yahoo dot com 2004-01-29 03:31 -------
Okay confirmed then. Hopefully somebody'll look at this though...
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-01-29 03:31:33
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13312
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/13312] [m68k] C++ produces stack frame damaging code for Coldfire
2003-12-05 6:31 [Bug c++/13312] New: C++ produces stack frame damaging code for Coldfire Steve at Zook dot com
` (8 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: bernie at develer dot com @ 2004-01-29 13:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bernie at develer dot com 2004-01-29 13:38 -------
I'll hopefully have some time to analyze this regression
along with a few other m68k target bugs after the next week.
Of course, I wouldn't mind if sombody else can fix it
before I do :-)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13312
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/13312] [m68k] C++ produces stack frame damaging code for Coldfire
2003-12-05 6:31 [Bug c++/13312] New: C++ produces stack frame damaging code for Coldfire Steve at Zook dot com
` (9 preceding siblings ...)
2004-01-29 13:38 ` bernie at develer dot com
@ 2004-06-10 8:03 ` bernie at develer dot com
10 siblings, 0 replies; 12+ messages in thread
From: bernie at develer dot com @ 2004-06-10 8:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bernie at develer dot com 2004-06-10 08:03 -------
This patch does indeed fix the bug:
http://gcc.gnu.org/ml/gcc/2004-05/msg01357.html
2004-05-27 Peter Jakubek <peter@laseranimation.com>
* reload.c (find_reloads): force reload for pseudo registers on big
endian machines.
The generated code to increment the word at -2(a6) with the
patch applied looks like this:
move.w -2(%a6),%d7
moveq #1,%d4
add.l %d4,%d7
move.w %d7,-2(%a6)
jbra .L122
*** This bug has been marked as a duplicate of 8309 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
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).