http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41894

--- Comment #12 from Ilya Lesokhin <ilya.lesokhin at gmail dot com> 2011-05-21 
14:47:33 UTC ---
Created attachment 24319
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24319
simple test case

i belive this is the same bug.

the problem occurs when using r28,r29 and accesing one of them.

as can be seen badCode() doesnt put the value 5 in tester. while goodCode does.


void badCode()
{
  a4:    ef 92           push    r14
  a6:    ff 92           push    r15
  a8:    cf 93           push    r28
  aa:    df 93           push    r29
    } t;

    t.deletedbyte = 5;
    asm (""    : "+y" (t) :);

    t.otherbyte = 17;
  ac:    81 e1           ldi    r24, 0x11    ; 17
  ae:    ec 01           movw    r28, r24

    asm (""    : "+y" (t) :);

    tester = t.deletedbyte;
  b0:    7e 01           movw    r14, r28
  b2:    f0 92 00 01     sts    0x0100, r15
}
  b6:    df 91           pop    r29
  b8:    cf 91           pop    r28
  ba:    ff 90           pop    r15
  bc:    ef 90           pop    r14
  be:    08 95           ret

000000c0 <goodCode>:

void goodCode()
{
  c0:    a0 e0           ldi    r26, 0x00    ; 0
  c2:    b5 e0           ldi    r27, 0x05    ; 5
    } t;

    t.deletedbyte = 5;
    asm (""    : "+x" (t) :);

    t.otherbyte = 17;
  c4:    a1 e1           ldi    r26, 0x11    ; 17

    asm (""    : "+x" (t) :);

    tester = t.deletedbyte;
  c6:    b0 93 00 01     sts    0x0100, r27
}
  ca:    08 95           ret

Reply via email to