Menu

#3805 Warning on function pointer return

closed-fixed
None
Front-end
5
2 days ago
2024-12-14
No

Compiling (need --stack-auto, or a port where that is the default) the following code using SDCC from current trunk gives a warning, which I think should not be there;

int f(int i, int j)
{
    return i + j;
}

typeof (int (*)(int, int)) g(void)
{
    return &f; // Why do we get a warning here? Bug.
}
warning 60: function return value mismatch
from type 'int function ( int auto, int auto) __reentrant fixed'
  to type 'int function ( int fixed, int fixed) __code* fixed'

Discussion

  • Philipp Klaus Krause

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -Compiling (meed `--stack-auto,` or a port where that is the default) the following code using SDCC from current trunk gives a warning, which I think should not be there;
    +Compiling (need `--stack-auto,` or a port where that is the default) the following code using SDCC from current trunk gives a warning, which I think should not be there;
    
     ~~~~
     int f(int i, int j)
    
     
  • Philipp Klaus Krause

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

    Fixed in the _Optional branch in [r16322].

     

    Related

    Commit: [r16322]

  • Philipp Klaus Krause

    • status: pending-fixed --> closed-fixed
     
  • Philipp Klaus Krause

    Fixed in the _Optional branch in [r16322].

     

    Related

    Commit: [r16322]


Log in to post a comment.

MongoDB Logo MongoDB