[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Clobber list isn't working
From: |
Eric Weddington |
Subject: |
RE: [avr-gcc-list] Clobber list isn't working |
Date: |
Wed, 25 Jul 2007 10:05:55 -0600 |
> -----Original Message-----
> From:
> address@hidden
> [mailto:address@hidden
> org] On Behalf Of Gre7g Luterman
> Sent: Wednesday, July 25, 2007 6:35 AM
> To: address@hidden
> Subject: RE: [avr-gcc-list] Clobber list isn't working
>
> --- 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.
True, but you said yourself that it was an absurd test case. Obviously a nop
doesn't clobber any registers.
> 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?
Hmm. I see what you mean. AVR GCC 4.2.1 generates the same code too.
Right now, all I can recommend is that you fill out a GCC Bug Report:
<http://gcc.gnu.org/bugzilla/>
Put me in the CC list so I can track the bug.
Eric Weddington