mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-12-02 00:52:19 +00:00
ce6b27cfae
It seems that the optimizer keeps array assignments live when passing the array as a pointer, but not when passing the address of an element. Found when testing the following code: BasisBlade *pga_blades[16] = { blades[1], blades[2], blades[3], blades[4], blades[7], blades[6], blades[5], blades[0], blades[8], blades[9], blades[10], blades[15], blades[14], blades[13], blades[12], blades[11], }; BasisGroup *pga_groups[4] = { [BasisGroup new:4 basis:&pga_blades[ 0]], [BasisGroup new:4 basis:&pga_blades[ 4]], [BasisGroup new:4 basis:&pga_blades[ 8]], [BasisGroup new:4 basis:&pga_blades[12]], }; Only the first element of pga_blades is being assigned in the optimized code, but everything is correct when not optimizing.
20 lines
223 B
R
20 lines
223 B
R
vector
|
|
bar (float *v)
|
|
{
|
|
return [v[0], v[1], v[2]];
|
|
}
|
|
|
|
vector
|
|
foo (float x, float y, float z)
|
|
{
|
|
float v[3] = { x, y, z };
|
|
return bar (&v[0]);
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
int ret = 0;
|
|
ret |= foo(1,2,3) != [1, 2, 3];
|
|
return ret;
|
|
}
|