------- Comment #4 from hochstein at algo dot informatik dot tu-darmstadt dot 
de  2006-03-14 08:27 -------
This is a GCC bug although my first test program did not show this.
Consider this program:

void a() 
{
}

void b() 
{
  __asm("nop\n nop\n nop\n nop\n nop\n nop");
  // ...
  // (repeat this line 500 times)
}

int main(){
 a();
}

Compile with
avr-gcc -mmcu=atmega8515 -c jmp-test.c

Now avr-objdump shows this:

Disassembly of section .text:
00000000 <a>:
       0:       cf 93           push    r28
       2:       df 93           push    r29
       4:       cd b7           in      r28, 0x3d       ; 61
       6:       de b7           in      r29, 0x3e       ; 62
       8:       df 91           pop     r29
       a:       cf 91           pop     r28
       c:       08 95           ret

[...]

0000178c <main>:
    178c:       c0 e0           ldi     r28, 0x00       ; 0
    178e:       d0 e0           ldi     r29, 0x00       ; 0
    1790:       de bf           out     0x3e, r29       ; 62
    1792:       cd bf           out     0x3d, r28       ; 61
    1794:       35 d4           rcall   .+2154          ; 0x2000 <main+0x874>
    1796:       00 c0           rjmp    .+0             ; 0x1798 <main+0xc>

The call to a() goes into nirvana since a() cannot be reached by
"rcall". "call" must be used instead. 
I suppose there is an analogous example for "rjmp".


-- 

hochstein at algo dot informatik dot tu-darmstadt dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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

  • [Bug target/26664... hochstein at algo dot informatik dot tu-darmstadt dot de

Reply via email to