Embedded Swift code on ESP32-C3 (riscv32 compiler) crashes when compiled with -Onone option

Source below compiled with -Onone to enable source code debugging is crashing :

There is no crash when compiled with -Osize option

Tested with Swift development snapshot 2024-06-13 and 2024-07-03

Do you mind opening a GitHub issue on the embedded examples repo with the backtrace attached?

My test project is based on the swift-matter-examples LED-blink git-hub project.

Comparing with swift-embedded-examples, I just realized that CMakeLists.txt for swift-matter-examples was missing compiler options below for ESP32-C3

    -Xcc -march=rv32imc_zicsr_zifencei
    -Xcc -mabi=ilp32

Adding those two options is fixing the crash when building with -Onone

Seems that someone created an issue two weeks ago, on the swift-matter-examples , for a similar swift_retain crash on ESP32 C3. I will add comment about missing march and mabi options

Thanks for you help.

2 Likes