On 8/4/05, Shaun Jackman <[EMAIL PROTECTED]> wrote:
> Are you using an x86 host and an arm target?
> 

Actually no, my major concern at the time was the large quantity of
legacy code with packed structures that we have on an embedded linux
x86 system. I was just testing that we didn't have an issue there with
the structure access.

> Did it produce an open code memcpy, and was it correct?
> 

I couldn't see any problems with the generated code - with no
optimisation memcpy was called as a normal function, under
optimisation the memcpy was replaced with the same code as the s->b =
n line produced.

> Interesting. Can you post an assembler snippet of this?
> 
I created an executable and made it report the alignment -
I used your test case and declared a variable of the packed structure then did
    printf("Address of a = %p\n", &test.a);
    printf("Address of b = %p\n", &test.b);
with interesting differences between gcc 3 and 4.

On further consideration i'd also add
    printf("Address of test = %p\n", &test);
just to see if it showed up anything interesting.

If I had more time I'd investigate where gcc 4 is putting this
variable in memory, I have a small concern that it may be leaving
padding bytes on the stack to align the structure, I'm not sure it's a
big issue though (it definitely isn't to me anyway since we're using
2.95.3 and the unmentionable 2.96 ;o) ).

Not sure any of this helps with the memcpy alignment issue though.

Reply via email to