Menu

#3768 sdcc pic14 --stack-auto Function parameters reversed

closed-invalid
nobody
None
PIC14
5
2024-11-29
2024-08-09
long_long
No

Hello, I use sdcc 4.4.0 pic14, under the command --stack-auto, c code:

#include "pic16f877a.h"

unsigned char k;

//----------------------------------------------------------------------------------
unsigned char compare(unsigned char a, unsigned char b)
{
    unsigned char result;

    if(a > b)
        result = 0x11;
    else
        result = 0x22;
    return result;
}

void main()
{
    k = compare(5, 20);
    while(1)
    {
        ;
    }
}

There is --stack-auto in the transfer. When comparing the asm code, it is only a small difference from the first paragraph. Is this correct? It seems that the a and b data are reversed after being passed in.

4 Attachments

Discussion

  • Philipp Klaus Krause

    I don't know if anyone can really help here, after all the pic14 port is unmaintained. I know nearly nothing about pic14. But: AFAIK, parameters on the stack are passed right-to-left for all ports.

     
    • long_long

      long_long - 2024-08-13

      Got it, thank you for your reply.

       
  • Benedikt Freisen

    Since nothing here appears to indicate actually broken code, I take it that this can be closed as invalid.

     

Log in to post a comment.

MongoDB Logo MongoDB