From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8448 invoked by alias); 29 Apr 2005 13:15:42 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 7856 invoked by uid 48); 29 Apr 2005 13:15:00 -0000 Date: Fri, 29 Apr 2005 13:15:00 -0000 From: "bernard dot fouche at kuantic dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20050429131455.21284.bernard.fouche@kuantic.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/21284] New: AVR target: switch/case jump table is placed in .data instead of .progmem.gcc_sw_table X-Bugzilla-Reason: CC X-SW-Source: 2005-04/txt/msg04079.txt.bz2 List-Id: 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