This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to solove warning recursive call to a constant

I have following codes:

void fun1(unsigned char *msg);

void fun2()
{
fun1("ssss");
}
void fun3()
{
}
code void (*func_array[])()={fun2, fun3};

void fun1( unsigned char *msg)
{
(*func_array[1])();
}

void main()
{
(*fun_array[0])();
}

when compiling, i got the following message
*** WARNING L13: RECURSIVE CALL TO SEGMENT
SEGMENT: ?CO?HELLO

Could you please tell me how to solve it? Thanks a lot!

Parents
  • I think my situation is a little different from what those APP discuss.

    PROGRAM RECURSIONS REMOVED FROM CALL TREE
    =========================================
    +--> ?CO?HELLO
    |  | ?PR?FUN2?HELLO
    <--+ ?PR?_FUN1?HELLO
    

    I also check the caller tree, i feel that fun1 overlay has some problem. a strage symbol comes out _fun1, but i don't know how to fix it? pls help. Thanks


    SEGMENT BIT_GROUP DATA_GROUP
    +--> CALLED SEGMENT START LENGTH START LENGTH
    ------------------------------------------------------------------
    ?C_C51STARTUP ----- ----- ----- -----
    +--> ?PR?MAIN?HELLO

    ?PR?MAIN?HELLO ----- ----- ----- -----
    +--> ?CO?HELLO
    +--> ?PR?PRINTF?PRINTF

    ?CO?HELLO ----- ----- ----- -----
    +--> ?PR?FUN2?HELLO
    +--> ?PR?FUN3?HELLO

    ?PR?FUN2?HELLO ----- ----- ----- -----
    +--> ?PR?_FUN1?HELLO

    ?PR?_FUN1?HELLO ----- ----- 0008H 0003H

    ?PR?PRINTF?PRINTF 0020H.0 0001H.1 0008H 0014H
    +--> ?PR?PUTCHAR?PUTCHAR

Reply
  • I think my situation is a little different from what those APP discuss.

    PROGRAM RECURSIONS REMOVED FROM CALL TREE
    =========================================
    +--> ?CO?HELLO
    |  | ?PR?FUN2?HELLO
    <--+ ?PR?_FUN1?HELLO
    

    I also check the caller tree, i feel that fun1 overlay has some problem. a strage symbol comes out _fun1, but i don't know how to fix it? pls help. Thanks


    SEGMENT BIT_GROUP DATA_GROUP
    +--> CALLED SEGMENT START LENGTH START LENGTH
    ------------------------------------------------------------------
    ?C_C51STARTUP ----- ----- ----- -----
    +--> ?PR?MAIN?HELLO

    ?PR?MAIN?HELLO ----- ----- ----- -----
    +--> ?CO?HELLO
    +--> ?PR?PRINTF?PRINTF

    ?CO?HELLO ----- ----- ----- -----
    +--> ?PR?FUN2?HELLO
    +--> ?PR?FUN3?HELLO

    ?PR?FUN2?HELLO ----- ----- ----- -----
    +--> ?PR?_FUN1?HELLO

    ?PR?_FUN1?HELLO ----- ----- 0008H 0003H

    ?PR?PRINTF?PRINTF 0020H.0 0001H.1 0008H 0014H
    +--> ?PR?PUTCHAR?PUTCHAR

Children
No data