This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/21171] Generates wrong code (w/ optimization) when copying data from a table to a table in a structure


------- Additional Comments From sami dot kantoluoto at embedtronics dot fi  2005-04-23 08:31 -------
Created an attachment (id=8713)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8713&action=view)
A bit more simplified test file with a test code that gets compiled correctly
commented out.

Code that gets compiled _corretly_:
    *(&CPUReg->SVR[c]) = __IntTable[c];

And code that doesn't:
    CPUReg->SVR[c] = __IntTable[c];


Objdump of working code:

test.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <main>:
   0:	e59f101c	ldr	r1, [pc, #28]	; 24 <.text+0x24>
   4:	e59f001c	ldr	r0, [pc, #28]	; 28 <.text+0x28>
   8:	e4912004	ldr	r2, [r1], #4
   c:	e59f3018	ldr	r3, [pc, #24]	; 2c <.text+0x2c>
  10:	e1510003	cmp	r1, r3
  14:	e4802004	str	r2, [r0], #4
  18:	1a000000	bne	8 <main+0x8>
  1c:	e3a00000	mov	r0, #0	; 0x0
  20:	e12fff1e	bx	lr

(this could be optimized by not reloading the r3 every loop).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21171


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]