avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] Clobber list isn't working


From: Gre7g Luterman
Subject: RE: [avr-gcc-list] Clobber list isn't working
Date: Wed, 25 Jul 2007 05:35:27 -0700 (PDT)

--- Eric Weddington <address@hidden> wrote:

> Can you provide your real test case instead of the
> degenerate case above?

Huh?  But that's the whole point of making a simple
test case.  That way I don't have to make you slog
through hundreds of pages of code and I don't have to
put my customer's code up on the 'net.

Here, just change the nop to something that actually
abuses r28 and you'll see a perfectly valid example:

void test(void)
{
    struct
    {
        int a, b, c, d, e, f;
    } x;

    x.d = 5;
    asm volatile("in r28, 0x2F" : : : "r28");
    x.d = 6;
}

which compiles to:
.
:
    x.d = 5;
  14:   85 e0           ldi     r24, 0x05       ; 5
  16:   90 e0           ldi     r25, 0x00       ; 0
  18:   98 87           std     Y+8, r25        ; 0x08
  1a:   8f 83           std     Y+7, r24        ; 0x07
    asm volatile("in r28, 0x2F" : : : "r28");
  1c:   cf b5           in      r28, 0x2f       ; 47
    x.d = 6;
  1e:   86 e0           ldi     r24, 0x06       ; 6
  20:   90 e0           ldi     r25, 0x00       ; 0
  22:   98 87           std     Y+8, r25        ; 0x08
  24:   8f 83           std     Y+7, r24        ; 0x07
.
:
As you can see, this code really does mess up r28, but
gcc presumes that Y is untouched. Obviously, this code
could use r0 instead of r28, but that's not the point.
 The problem is that gcc should be respecting the
clobber list or spitting out an error.

Ideas?

Gre7g



       
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]