uxmal / reko

Reko is a binary decompiler.
https://uxmal.github.io/reko
GNU General Public License v2.0
2.14k stars 253 forks source link

MacOS Classic (Master) - // Failed to bind call argument. #1278

Closed gbody closed 1 year ago

gbody commented 1 year ago

Sample program LinkIIgs There are a number of Failed to bind call argument after processing

Example Procedure print_time I would expect that the reference stackArg12 should have been resolved to dwArg04

word32 print_time(char (* dwArg04)[])
{
    ptr32 fp;
    ci16 wLoc0C;
    word16 wLoc08;
    word16 wLoc0A;
    word16 wLoc12;
    word16 wLoc0E;
    ui16 wLoc10;
    ui16 wLoc06;
    char (* d0_48)[];
    word32 v11_24 = *(word32 *) 0x020C;
    GetTime(fp + ~0x11);
    int32 d0_33 = memory_avail();
    if ((wLoc0C > 0x0C ? ~0x00 : 0x00) != 0x00)
        d0_48 = g_116320;
    else
        d0_48 = g_116324;
    int32 d0_77 = (int32) wLoc0C;
    fprintf(g_116B24, "%s, %s %d, %d %d:%.2d:%.2d %s (%.7d bytes of memory available)", *((char *) g_a1163A2 + wLoc06 * 0x04), *((char *) g_a11636E + wLoc10 * 0x04), (int32) wLoc0E, (int32) wLoc12, (int32) (int16) __swap(SEQ(d0_77 % 0x0C, d0_77 /16 0x0C)), (int32) wLoc0A, (int32) wLoc08, d0_48, d0_33);
    if (dwArg04 != null)
    {
        // Failed to bind call argument.
        // Please report this issue at https://github.com/uxmal/reko
        char * stackArg12 = (char *) <invalid>;
        fprintf(g_116B24, " %s", stackArg12);
    }
    fprintf(g_116B24, "\r");
    return v11_24;
}
00104222 200C           move.l a4,d0       |
00104224 4FEF 002C      lea $002C(a7),a7   | 
00104228 6712           beq $0010423C      |  if (dwArg04 != null)
0010422A 2F0C           move.l a4,-(a7)    | StackArg12 should be equal to dwArg04
0010422C 486D F6B8      pea -$0948(a5)
00104230 486D FE74      pea -$018C(a5)
00104234 4EBA 394A      jsr.l fprintf          
gbody commented 1 year ago

Project file. LinkIIGS---procedure-names.zip

uxmal commented 1 year ago

Commit e1bfb75 resolved this issue. Thanks for reporting it!