Bug compiling embedded Swift project with -no-allocations
flag enabled with swift-mmio
#76857
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
I understand that the
-no-allocations
flag is not fully baked yet or complete, but for giggles I enabled it on my Swift for Embedded project for an STM32C011 and found that swift-mmio does not compile properly with an error:Reproduction
To reproduce this it requires setting up a Swift SDK to provide the
-no-allocations
flag and other flags to swiftpm so it can properly cross compile for the target. I have an example repo here that does just this:https://github.com/xtremekforever/swift-stm32c011-examples/tree/feature/no-allocations/blink-mmio
To replicate the issue, grab the repo at this branch, then compile the project with the make command:
$ https://github.com/xtremekforever/swift-stm32c011-examples.git -b feature/no-allocations $ cd swift-stm32c011-examples/blink-mmio $ make
After building for a while, you should see the error eventually when building swift-mmio for the target:
Expected behavior
Since
swift-mmio
does not allocate any heap memory by design, I would expect that the-no-allocations
flag does not throw an error that a heap operation is being performed.Environment
Swift version 6.1-dev (LLVM 89ccf4b8a46135a, Swift 6a5ae8d)
Target: x86_64-unknown-linux-gnu
Additional information
I also tested this with the Swift 6.0.1 release with the same result.
The text was updated successfully, but these errors were encountered: