Dear Oleg:

I think that there is no bug. Should I suggest trying ...

struct x *tmp;


Kind regards,

Roberto G. Berner
booleangene...@ciudad.com.ar
ven...@increible.homelinux.com
4308 3500 tel
4308 3700 fax
15 5122 6095 cel

  ----- Original Message ----- 
  From: Oleg Skydan 
  To: MSP430 GCC 
  Sent: Wednesday, January 22, 2003 12:12 PM
  Subject: [Mspgcc-users] Struct assignment BUG...


  Hello, All !

  I found a significant BUG when using struct assignment.

  Here is the sample:

  struct x{
  int a,b,c,d;
  };

  struct x *v[2];

  void swap(void)
  {
  struct x tmp;
   tmp=*v[0];
   *v[0]=*v[1];
   *v[1]=tmp;
  }

  And here is GCC's listing (with -O option):

  /***********************
   * Function `swap' 
   ***********************/
  swap:
  /* prologue: frame size = 8 */
  .L__FrameSize_swap=0x8
  .L__FrameOffset_swap=0x8
   sub #8, r1 ; 8, fpn 0
  /* prologue end (size=1) */
   mov &v, r15 
   mov @r15+, @r1
   mov @r15+, 2(r1)
   mov @r15+, 4(r1)
   mov @r15+, 6(r1)
   mov &v+2, r14 
   mov @r14+, 0(r15)
   mov @r14+, 2(r15)
   mov @r14+, 4(r15)
   mov @r14+, 6(r15)
   mov &v+2, r15 
   mov @r1+, 0(r15)       ;We should not change the stack pointer here !
   mov @r1+, 2(r15)
   mov @r1+, 4(r15)
   mov @r1+, 6(r15)
  /* epilogue: frame size=8 */
   add #8, r1                    ;After this command the stack pointer points 
to the illegal location !
   ret
  /* epilogue end (size=2) */
  /* function swap size 33 (30) */


  I use win32 version (from 10.12.2002).
  Thanks, Oleg.


Reply via email to