This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
gcc 3.4.0 m68k-elf generates illegal code for ColdFire
- From: peter at lasergraph-dsp dot de
- To: gcc at gcc dot gnu dot org
- Date: Wed, 26 May 2004 02:24:25 +0200
- Subject: gcc 3.4.0 m68k-elf generates illegal code for ColdFire
- Bcc: peter at lasergraph-dsp dot de
Dear gcc gurus,
gcc 3.4.0 generates illegal code for the following function,
when compiled with:
m68k-elf-gcc.exe -O2 -m5307 -c test.cc -fverbose-asm -save-temps
//test.cc: --------------------------
void test_addl ()
{
for (short c1 = 0; c1 < 8; c1++) {
for (short c2 = 0; c2 < 8; c2++) {
for (short c3 = 0; c3 < 8; c3++) {
for (short c4 = 0; c4 < 8; c4++) {
for (short c5 = 0; c5 < 8; c5++) {
for (short c6 = 0; c6 < 8; c6++) {
for (short c7 = 0; c7 < 8; c7++) {
for (short c8 = 0; c8 < 8; c8++) {
for (short c9 = 0; c9 < 8; c9++) {
for (short c10 = 0; c10 < 8; c10++) {
for (short c11 = 0; c11 < 8; c11++) {
for (short c12 = 0; c12 < 8; c12++) {
for (short c13 = 0; c13 < 8; c13++) {
}}}}}}}}}}}}}
}
// test.cc: --------------------------
The problematic code is the handling of c7:
moveq #1,%d0 |,
add.l %d0,-2(%a6) |, c7
move.w -2(%a6),%a0 | c7, c7
cmp.l %a0,%d2 | c7,
c7 (a 16 bit variable) is allocated at -2(%a6) on the stackframe.
To increment it a 32 bit add.l ist used. This is wrong.
The M5307 (ColdFire) does not support add.w. Probably everything
was fine if the address had been corrected to -4(%a6).
(It looks like 32 bits are reserved for c7)
Any suggestions how this can be fixed?
PS: Yes I know the code is not useful, but it also happens in real
code. The sample here is just an easy way to reproduce the problem.
Thanks in advance,
Peter Jakubek
LaserAnimation Sollinger GmbH
peter@lasergraph-dsp.de