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

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

Antworten: Re: [avr-gcc-list] Problem with the calling convention


From: Martin Krüger
Subject: Antworten: Re: [avr-gcc-list] Problem with the calling convention
Date: Wed, 14 Jul 2004 13:56:11 GMT

 Ursprüngliche Nachricht ------- 
Von: address@hidden (Joerg Wunsch) 
Datum: Wed, 14 Jul 2004 14:41:53 +0200 (MET DST) 
Betreff: Re: [avr-gcc-list] Problem with the calling convention 

"Martin Krüger "  wrote:

>> The problem ist   another function called using r19,r18 without pushing
>> and restoring its values.

>That might be a bug.  r18/r19 are considered to be private to each
>function (i. e. the called function is allowed to destroy them).

>Make sure you've got all function prototype declarations OK.  If the
>problem persists, post a source code snippet demonstrating the
>problem.

Ok here  it is:
##############################################################
void  testfunc32(unsigned long);
void  testfunc16(int);
void testfunc8(char);

void testfunc(unsigned int a,char b,char c,unsigned long d)
{
        testfunc16(a);
        testfunc8(10);
        testfunc8(b);
        testfunc16(11);
        testfunc8(c);
        testfunc8(6);
        testfunc32(d);
}


void test()
{
testfunc(0xabcd,10,11,0xabacadae);
}
##############################################################
compilation with:
avr-gcc -c -Os  test.c (without optimization the code seems to be ok)

avr-objdump -D test.o

The we will see the call to testfunc32

mov     r25, r19
mov     r24, r18
mov     r23, r17
mov     r22, r16
rcall   .+0

This code is executed after all the other function-calls.
Any of these could have modified the values of  r19,r18

__________________________________________________________________
Digitalkameras - Aktuelle Angebote unter EUR 90,- www.ebay.de!!
Über 1 Mio. Angebote zu günstigen Preisen! eBay - Jetzt besser kaufen! 


reply via email to

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