Can someone explain to me, this is a compilation error in the experimental 
branch MSPGCC, or some feature of the compiler?

int main(void)
{
  WDTCTL=WDTPW|WDTTMSEL|WDTSSEL|WDTIS0;
 
  volatile uint8_t a, b, c;
 
  a=0b10000111;
  b=0b10000101;
 
  if((a^b)&0x80) c=0xAA; //checking MSB (a xor b), must be 0
    else c=0xBB;
 
  if(c==0xAA) led_on();
  /*
  In experimental version of GCC  (mspgcc-20120224-experimental) this condition 
is TRUE, while should be FALSE.
  Stable version mspgcc-20110716-p20111105  works correctly (condition is FALSE)
  */
}

ASM listing:

---mspgcc-20120224-experimental:
  a=0b10000111;
    cc8c:       f1 40 87 ff     mov.b   #-121,  2(r1)   ;#0xff87, 0x0002(r1)
    cc90:       02 00 
  b=0b10000101;
    cc92:       f1 40 85 ff     mov.b   #-123,  1(r1)   ;#0xff85, 0x0001(r1)
    cc96:       01 00 

  if((a^b)&0x80) c=0xAA;
    cc98:       5e 41 02 00     mov.b   2(r1),  r14     ;0x0002(r1)
    cc9c:       5f 41 01 00     mov.b   1(r1),  r15     ;0x0001(r1)
    cca0:       4f ee           xor.b   r14,    r15     
    cca2:       04 34           jge     $+10            ;abs 0xccac  <---------
    cca4:       f1 40 aa ff     mov.b   #-86,   0(r1)   ;#0xffaa, 0x0000(r1)
    cca8:       00 00 
    ccaa:       03 3c           jmp     $+8             ;abs 0xccb2
    else c=0xBB;
    ccac:       f1 40 bb ff     mov.b   #-69,   0(r1)   ;#0xffbb, 0x0000(r1)
    ccb0:       00 00 

---mspgcc-20110716-p20111105:
  a=0b10000111;
    ccda:       f1 40 87 ff     mov.b   #-121,  0(r1)   ;#0xff87, 0x0000(r1)
    ccde:       00 00 
  b=0b10000101;
    cce0:       f1 40 85 ff     mov.b   #-123,  1(r1)   ;#0xff85, 0x0001(r1)
    cce4:       01 00 

  if((a^b)&0x80) c=0xAA;
    cce6:       5f 41 01 00     mov.b   1(r1),  r15     ;0x0001(r1)
    ccea:       6f e1           xor.b   @r1,    r15     
    ccec:       4f 93           tst.b   r15             <--------- 
    ccee:       04 34           jge     $+10            ;abs 0xccf8
    ccf0:       f1 40 aa ff     mov.b   #-86,   2(r1)   ;#0xffaa, 0x0002(r1)
    ccf4:       02 00 
    ccf6:       03 3c           jmp     $+8             ;abs 0xccfe
    else c=0xBB;
    ccf8:       f1 40 bb ff     mov.b   #-69,   2(r1)   ;#0xffbb, 0x0002(r1)
    ccfc:       02 00

:: mailto:gosp...@gmail.com


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to