Andy H schreef:
> I think I have found a simple fix.
>
> I changed gcc so that offsets added to assembler symbols are doubled. So
> in c when we use &foo+2 this gets send to assembler/linker as gs(foo+4).
>
> This has the effect that offsets or arithmetic are consistently in words
> - on a word pointer. (which makes more sense)
>
> Now it does not matter if optimisation  creates  p=&foo+2  OR p=&foo,
> p=p+2 as the result will be the same.
> I attach test program I used to check several variant and it worked.
> Apart from normal warning messages about linker stubs. There also lst
> and lss files you can look at what gets send to assembler and code
> produced.
>

It looks ok to me (just looking at the lss, not rebuilding gcc)
but the code is not optimal. It is moving to r18 doing the operation and then moving it back to r24. Is this because of your patch? Or something else?

HTH,

Wouter


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to