Menu

#2556 Function returning function pointer

closed-fixed
None
Front-end
7
2017-10-08
2016-10-25
No

Compiling a function returning a function pointer

typedef void l_fptr_1(void);

l_fptr_1 *dosub(void);

l_fptr_1 *dosub(void)
{
    return 0;
}

is broken in sdcc 3.6.3 #9791 (I tired stm8, mcs51, z80):

test.cbe.c:6: error 98: conflict with previous definition of 'dosub' for attribute 'type'
from type 'void function ( ) code* function ( ) fixed'
  to type 'void function ( ) generic* function ( ) fixed'

Philipp

Related

Bugs: #2629

Discussion

  • Philipp Klaus Krause

    • Priority: 5 --> 7
     
  • Philipp Klaus Krause

    This issue prevents compilation of current NuttX with current SDCC.

    In particular sigset() from libc/signal/sig_set.c.

    Philipp

     
  • Philipp Klaus Krause

    It seems function declarations are first checked against previous declarations, then processed in addSymChain(). The "code" seems to get added somewhere in addSymChain (it is not there at the beginning of addSymChain(), but is there when addSym() is called. Thus at the second declaration, at the check, the first declaration already has the code added, but the second does not, so there is a mismatch.

    Philipp

    P.S.: It seems the change is happening in changePointer(), called from addSymChain().

     

    Last edit: Philipp Klaus Krause 2017-10-08
  • Philipp Klaus Krause

    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    • status: open --> closed-fixed
    • Category: other --> Front-end
     
  • Philipp Klaus Krause

    Fixed in revision [r10039].

    Philipp

     

Log in to post a comment.

MongoDB Logo MongoDB