← board

riscv32 / xtensa (--esp-profile=bare) reject even a trivial program — unsupported call_ind node

Problem

stable_linux_amd64/default/pinned (v153, the current pin — no live-source confound) cannot compile test/test_esp_bare.pas, the project's own ESP32 bare-metal boot test, for either bare-metal profile:

$ ./pinned --target=riscv32 --esp-profile=bare test/test_esp_bare.pas /tmp/out.elf
pascal26:1209: error: target riscv32: unsupported node in IR codegen ()

$ ./pinned --target=xtensa --esp-profile=bare test/test_esp_bare.pas /tmp/out.elf
pascal26:1209: error: target xtensa: unsupported node in IR codegen: call_ind ()

This reproduces deterministically (3/3 runs each, pinned binary is immutable so there's no concurrent-rebuild confound). It also reproduces on a maximally trivial program with nothing ESP-specific at all:

program P;
begin
end.

— same error, both targets, with or without --esp-profile=bare, with or without -dPXX_ESP_BARE (that define does nothing; the real flag is --esp-profile=bare, confirmed from tools/esp_run_bare.sh). Bisected further on riscv32: fails identically with just a bare Int64/Integer var decl, an assignment, or writeln — i.e. the failure isn't specific to Int64 math, WriteLn, or any RTL feature; it fires on any program, even one with an empty body.

The riscv32 error message is missing the node name (unsupported node in IR codegen () — empty parens) while the xtensa one names it: call_ind (indirect call). Given the riscv32 catch-all Error(...) call (ir_codegen_riscv32.inc:1344) doesn't append IROpName(IRKind[node]) the way the xtensa one does (ir_codegen_xtensa.inc:1737), riscv32 is very likely hitting the same call_ind node — just with a less informative message (worth fixing alongside, see below).

Why this looks like a regression, not a known gap

Impact

Suggested investigation starting points (not prescriptive — Track A's call)

Acceptance

Log