c3c icon indicating copy to clipboard operation
c3c copied to clipboard

Compiler assert with complex address in inline assembly.

Open srkkov opened this issue 3 months ago • 4 comments

module main;

fn int main() 
{
    int x;
    asm
    {
        movl $eax, [&x + 1];
    }
    return 0;
}
⚠️ The compiler encountered an unexpected error: "TODO reached".

- Function: sema_check_asm_arg_addr(...)
- Source file: c3c/src/compiler/sema_asm.c:229

srkkov avatar Sep 01 '25 21:09 srkkov

looks like this is a duplicate of #1927

Book-reader avatar Sep 01 '25 21:09 Book-reader

So sorry! What about this?

module main;

fn int main() 
{
    int x;
    asm
    {
        movl x, &x;
    }
    return 0;
}
⚠️ The compiler encountered an unexpected error: "TODO reached".

- Function: sema_check_asm_arg(...)
- Source file: c3c/src/compiler/sema_asm.c:542

srkkov avatar Sep 01 '25 21:09 srkkov

That is different, but seems like it's under the same banner as the other issue. It could probably be added as a comment on the other issue or kept on this one, ig it's up to your/@lerno's judgment.

Book-reader avatar Sep 01 '25 21:09 Book-reader

That latter is part of the size checking.

lerno avatar Sep 06 '25 22:09 lerno