been discussed.
this been fixed a while ago.
check new gcc sources.

~d
P.S. are you sure this code really working? ;)

On Wednesday 12 February 2003 22:59, D.Pageau wrote:
> mspgcc win32 build 2002-12-17 from www.mikrocontroller.net fail to
> compile working code with -O2 flag.
>
> Here a example from the TCPIP source.
>
> memcpy(&TxFrame2[ETH_SA_OFS], &MyMAC, 6);
> 1c0c: 3f 40 6d 11             mov     #4461,  r15     ;#0x116d
> 1c10: b2 4f 06 02             mov     @r15+,  &0x0206 ;
> 1c14: b2 4f 08 02             mov     @r15+,  &0x0208 ;
> 1c18: b2 4f 0a 02             mov     @r15+,  &0x020a ;
> memcpy(&TxFrame2[ARP_SENDER_HA_OFS], &MyMAC, 6);         // !HERE! 1c38:      
> b2
> 4f 16 02              mov     @r15+,  &0x0216 ;
> 1c3c: b2 4f 18 02             mov     @r15+,  &0x0218 ;
> 1c40: b2 4f 1a 02             mov     @r15+,  &0x021a ;
>
> R15 should be reset to 0x116d in the second call of memcpy.  I don't
> know if it's a bug in memcpy where the pointer on &MyMAC need some
> special keyword like "volatile" or it's a bug un the optimization.
>
> memcpy(&TxFrame2[ETH_SA_OFS], &MyMAC, 6);
> 1c0c: 3f 40 6d 11             mov     #4461,  r15     ;#0x116d
> 1c10: b2 4f 06 02             mov     @r15+,  &0x0206 ;
> 1c14: b2 4f 08 02             mov     @r15+,  &0x0208 ;
> 1c18: b2 4f 0a 02             mov     @r15+,  &0x020a ;
> *(unsigned int *)&TxFrame2[ETH_TYPE_OFS] = SWAPB(FRAME_ARP);
> 1c1c: b2 40 08 06 0c 02       mov     #1544,  &0x020c ;#0x0608
>
> // ARP
> *(unsigned int *)&TxFrame2[ARP_HARDW_OFS] = SWAPB(HARDW_ETH10);
> 1c22: b2 40 00 01 0e 02       mov     #256,   &0x020e ;#0x0100
> *(unsigned int *)&TxFrame2[ARP_PROT_OFS] = SWAPB(FRAME_IP);
> 1c28: b2 42 10 02             mov     #8,     &0x0210 ;subst r2 with As==11
> *(unsigned int *)&TxFrame2[ARP_HLEN_PLEN_OFS] = SWAPB(IP_HLEN_PLEN);
> 1c2c: b2 40 06 04 12 02       mov     #1030,  &0x0212 ;#0x0406
> *(unsigned int *)&TxFrame2[ARP_OPCODE_OFS] = SWAPB(OP_ARP_REQUEST);
> 1c32: b2 40 00 01 14 02       mov     #256,   &0x0214 ;#0x0100
> memcpy(&TxFrame2[ARP_SENDER_HA_OFS], &MyMAC, 6);         // !HERE!  1c38:     
> b2
> 4f 16 02              mov     @r15+,  &0x0216 ;
> 1c3c: b2 4f 18 02             mov     @r15+,  &0x0218 ;
> 1c40: b2 4f 1a 02             mov     @r15+,  &0x021a ;

-- 
/********************************************************************
     ("`-''-/").___..--''"`-._     (\   Dimmy the Wild      UA1ACZ
      `6_ 6  )   `-.  (     ).`-.__.`)  Enterprise Information Sys 
      (_Y_.)'  ._   )  `._ `. ``-..-'   Nevsky prospekt,   20 / 44
    _..`--'_..-_/  /--'_.' ,'           Saint Petersburg,   Russia
   (il),-''  (li),'  ((!.-'             +7 (812)  3468202, 5585314
 ********************************************************************/


Reply via email to