rather odd bug with arrays - possibly compiler?
J Grant
jg@jguk.org
Thu Dec 13 02:37:00 GMT 2001
Hello
I have a 3D array ulong v[32][768[1024], x (32) is access packed 32
bits.
i traverse the array in all three axis ( 3 sections, with the each axis
in the centre of its own loop)
e.g.
loop z
loop y
loop x
.........
loop z end
loop y end
loop x end
loop z
loop x
loop y
.........
loop end
loop end
loop end
loop y
loop x
loop z
.........
loop end
loop end
loop end
the X is slightly different as it is packed, but they all use the same C
code, just cut n pasted into different loop order to traverse along
different axis.
However I was amazed to find the centre loop above took 10 seconds when
X took 1.1 and Z took 1.2
this is rather odd, all I could think of during testing was that it is
to do with the way a flat array is converted to 3D so it is actually
reading along the Z axis for that one, but it does not make much sense
to myself.
maybe it is missing processor Cache, due to bad prediction and having to
wait. I dont know.
If anyone has an idea why this is please let me know. I compiled with
-O3 and -O2 and the others but no difference to the Y axis over the
others
if you need more info just let me know!
JG
More information about the Gcc-bugs
mailing list