Menu

#3054 FATAL Compiler Internal Error + SIGSEGV on struct return

closed-fixed
None
other
5
2023-01-26
2020-06-14
No
struct s
{
    char x[5];
};

struct s g();

void f(void)
{
    g();
}

Compiling with sdcc test.c -mz80 outputs this :

test.c:10: error 9: FATAL Compiler Internal Error in file 'gen.c' line number '1688' : Symbol in register, but no register assigned. 
Contact Author with source code
Symbol iTemp0 at ic 2.
Caught signal 11: SIGSEGV

Tested on commit 11672.

Related

Wiki: NGI0-Entrust-SDCC

Discussion

  • Phillip Stevens

    Phillip Stevens - 2021-05-19

    With r12391

    > test.c:10: error 9: FATAL Compiler Internal Error in file 'gen.c' line number '1761' : Symbol in register, but no register assigned. 
    > Contact Author with source code
    > Symbol iTemp0 at ic 2.
    > Caught signal 11: SIGSEGV
    
     
  • Philipp Klaus Krause

    • summary: [z80] FATAL Compiler Internal Error + SIGSEGV on struct return --> FATAL Compiler Internal Error + SIGSEGV on struct return
     

    Related

    Wiki: z80

  • Philipp Klaus Krause

    Basically the same problem happens for all z80-related ports and for stm8.
    For mcs51, hc08 and s08 it looks to me as if incorrect code is generated.
    For pdk13, pdk14 and pdk15, the generated code looks correct, unless --stack-auto is used.

     

    Last edit: Philipp Klaus Krause 2021-05-19
  • Philipp Klaus Krause

    As of [r12392], there is some progress: The exact scenario of the bug report now works for z80 and related ports: A caller that calls a function returning struct, and not using the returned value.

    In particular, the following still don't work:

    • A caller that actually uses the returned value (it looks like some earlier phase of SDCC is over-eager in turning struct stuff into pointer stuff).
    • A callee that returns a struct (but there we at least do get an error message telling us that this simply isn't supported yet).
     
    👍
    1
  • Philipp Klaus Krause

    • status: open --> closed-fixed
    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    There has been substantial progress on struct return values in mid-2022. Basically, it should just work. If there are remaining issues for some corner cases, they get their own bug reports.

     

Log in to post a comment.

MongoDB Logo MongoDB