public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21284] New: AVR target: switch/case jump table is placed in .data instead of .progmem.gcc_sw_table
@ 2005-04-29 13:15 bernard dot fouche at kuantic dot com
2005-04-29 13:19 ` [Bug target/21284] " pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: bernard dot fouche at kuantic dot com @ 2005-04-29 13:15 UTC (permalink / raw)
To: gcc-bugs
The following example is a test case showing the problem.
The jump table is placed in .data on gcc-4.0.0 instead of flash memory.
Gcc-4.0.0 was configured that way:
./configure --prefix=/home/avrdev --target=avr --enable-languages=c,c++
--disable-nls
[bernard@linuxbf stk500]$ cat testbug.c
unsigned long TestBug(int p)
{
unsigned long x=200;
unsigned long y=1;
switch(p){
case 0:
x=1;
y++;
break;
case 1:
x=2;
y++;
break;
case 2:
x=3;
y=2;
break;
case 3:
x=4;
y=34;
break;
case 4:
x=5;
y=38;
break;
case 5:
x=6;
y=9;
break;
case 6:
x=7;
y=71;
break;
case 7:
x=8;
y=712;
break;
case 8:
x=9;
y=-1;
break;
case 9:
x=10;
y=10;
break;
case 10:
x=11;
y=12;
break;
case 11:
x=12;
y=123;
break;
case 12:
x=13;
y=124;
break;
case 13:
x=14;
y=122;
break;
case 14:
x=15;
y=121;
break;
case 15:
x=1;
y++;
break;
case 16:
x=2;
y++;
break;
case 17:
x=3;
y=2;
break;
case 18:
x=4;
y=34;
break;
case 19:
x=5;
y=38;
break;
case 20:
x=6;
y=9;
break;
case 21:
x=7;
y=71;
break;
case 22:
x=8;
y=712;
break;
case 23:
x=9;
y=-1;
break;
case 24:
x=10;
y=10;
break;
case 25:
x=11;
y=12;
break;
case 26:
x=12;
y=123;
break;
case 27:
x=13;
y=124;
break;
case 28:
x=14;
y=122;
break;
case 29:
x=15;
y=121;
break;
}
return x*y;
}
[bernard@linuxbf stk500]$ avr-gcc --version
avr-gcc (GCC) 3.4.3
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[bernard@linuxbf stk500]$ avr-gcc -Os -Wall -c testbug.c
[bernard@linuxbf stk500]$ avr-objdump -s testbug.o
testbug.o: file format elf32-avr
Contents of section .text:
0000 cf93df93 c8ecd0e0 e0e0f0e0 21e030e0 ............!.0.
0010 40e050e0 aa2797fd a095ba2f 8e319105 @.P..'...../.1..
0020 08f083c0 80509040 8f939f93 0895c1e0 .....P.@........
0030 d0e0e0e0 f0e009c0 c2e0d0e0 e0e0f0e0 ................
0040 43c0c3e0 d0e0e0e0 f0e022e0 30e040e0 C.........".0.@.
0050 50e06bc0 c4e0d0e0 e0e0f0e0 22e230e0 P.k.........".0.
0060 40e050e0 62c0c5e0 d0e0e0e0 f0e026e2 @.P.b.........&.
0070 30e040e0 50e059c0 c6e0d0e0 e0e0f0e0 0.@.P.Y.........
0080 29e030e0 40e050e0 50c0c7e0 d0e0e0e0 ).0.@.P.P.......
0090 f0e027e4 30e040e0 50e047c0 c8e0d0e0 ..'.0.@.P.G.....
00a0 e0e0f0e0 28ec32e0 40e050e0 3ec0c9e0 ....(.2.@.P.>...
00b0 d0e0e0e0 f0e02fef 3fef4fef 5fef35c0 ....../.?.O._.5.
00c0 cae0d0e0 e0e0f0e0 2c2f3d2f 4e2f5f2f ........,/=/N/_/
00d0 2cc0cbe0 d0e0e0e0 f0e02ce0 30e040e0 ,.........,.0.@.
00e0 50e023c0 cce0d0e0 e0e0f0e0 2be730e0 P.#.........+.0.
00f0 40e050e0 1ac0cde0 d0e0e0e0 f0e02ce7 @.P...........,.
0100 30e040e0 50e011c0 cee0d0e0 e0e0f0e0 0.@.P...........
0110 2ae730e0 40e050e0 08c0cfe0 d0e0e0e0 *.0.@.P.........
0120 f0e029e7 30e040e0 50e06c2f 7d2f8e2f ..).0.@.P.l/}/./
0130 9f2f00d0 b92fa82f 972f862f 682f792f ./..././././h/y/
0140 8a2f9b2f df91cf91 0895 ././......
Contents of section .progmem.gcc_sw_table:
0000 00c000c0 00c000c0 00c000c0 00c000c0 ................
0010 00c000c0 00c000c0 00c000c0 00c000c0 ................
0020 00c000c0 00c000c0 00c000c0 00c000c0 ................
0030 00c000c0 00c000c0 00c000c0 ............
[bernard@linuxbf stk500]$ avr-gcc --version
avr-gcc (GCC) 4.0.0
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[bernard@linuxbf stk500]$ avr-gcc -Os -Wall -c testbug.c
[bernard@linuxbf stk500]$ avr-objdump -s testbug.o
testbug.o: file format elf32-avr
Contents of section .text:
0000 f92fe82f 4e9760f4 e050f040 09946fe0 ././N.`..P.@..o.
0010 70e080e0 90e029e7 30e040e0 50e07ec0 p.....).0.@.P.~.
0020 68ec70e0 80e090e0 21e030e0 40e050e0 h.p.....!.0.@.P.
0030 75c061e0 70e080e0 90e004c0 62e070e0 u.a.p.......b.p.
0040 80e090e0 22e030e0 40e050e0 67c063e0 ....".0.@.P.g.c.
0050 70e080e0 90e0f6cf 64e070e0 80e090e0 p.......d.p.....
0060 22e230e0 40e050e0 59c065e0 70e080e0 ".0.@.P.Y.e.p...
0070 90e026e2 30e040e0 50e050c0 66e070e0 ..&.0.@.P.P.f.p.
0080 80e090e0 29e030e0 40e050e0 47c067e0 ....).0.@.P.G.g.
0090 70e080e0 90e027e4 30e040e0 50e03ec0 p.....'.0.@.P.>.
00a0 68e070e0 80e090e0 28ec32e0 40e050e0 h.p.....(.2.@.P.
00b0 35c069e0 70e080e0 90e02fef 3fef4fef 5.i.p...../.?.O.
00c0 5fef2cc0 6ae070e0 80e090e0 2ae030e0 _.,.j.p.....*.0.
00d0 40e050e0 23c06be0 70e080e0 90e02ce0 @.P.#.k.p.....,.
00e0 30e040e0 50e01ac0 6ce070e0 80e090e0 0.@.P...l.p.....
00f0 2be730e0 40e050e0 11c06de0 70e080e0 +.0.@.P...m.p...
0100 90e02ce7 30e040e0 50e008c0 6ee070e0 ..,.0.@.P...n.p.
0110 80e090e0 2ae730e0 40e050e0 00d00895 ....*.0.@.P.....
Contents of section .data:
0000 00c000c0 00c000c0 00c000c0 00c000c0 ................
0010 00c000c0 00c000c0 00c000c0 00c000c0 ................
0020 00c000c0 00c000c0 00c000c0 00c000c0 ................
0030 00c000c0 00c000c0 00c000c0 ............
[bernard@linuxbf stk500]$
--
Summary: AVR target: switch/case jump table is placed in .data
instead of .progmem.gcc_sw_table
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bernard dot fouche at kuantic dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21284
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-05-05 16:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-29 13:15 [Bug c/21284] New: AVR target: switch/case jump table is placed in .data instead of .progmem.gcc_sw_table bernard dot fouche at kuantic dot com
2005-04-29 13:19 ` [Bug target/21284] " pinskia at gcc dot gnu dot org
2005-04-29 17:02 ` ericw at evcohs dot com
2005-05-05 15:37 ` cvs-commit at gcc dot gnu dot org
2005-05-05 15:42 ` cvs-commit at gcc dot gnu dot org
2005-05-05 16:26 ` [Bug target/21284] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
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).