Problem with reordering of memory accesses

Michael Schwingen michaels@stochastik.rwth-aachen.de
Wed Oct 18 09:26:00 GMT 2000


On Tue, Oct 17, 2000 at 11:30:42AM -0700, Geoff Keating wrote:
> If you can provide an example, it might be able to be fixed...

This turned out to be quite easy:

typedef struct
{
           int x1;
           short x2;
  volatile void *x3;
           void *x4;
  volatile void *x5;
           void *x6;
           void *x7;
} foo;

void TestFnc(foo *p)
{
  p->x5 = 0;
  p->x3  = 0;
}

powerpc-eabi-gcc -O3 -mcpu=860 -S test2.c

	.file	"test2.c"
gcc2_compiled.:
	.section	".text"
	.align 2
	.globl TestFnc
	.type	 TestFnc,@function
TestFnc:
	li 0,0
	stw 0,8(3)   // the first write should be to x5, which is 16(r3)
	stw 0,16(3)
	blr
.Lfe1:
	.size	 TestFnc,.Lfe1-TestFnc
	.ident	"GCC: (GNU) 2.96 20000417 (experimental)"
(also verified using 2.95.2)

cu
Michael
-- 
"Intelligent life is very rare in the universe.
 On earth, it has not been discovered yet"     (Stephen Hawking)


More information about the Gcc mailing list