Open xtremekforever opened 2 weeks ago
The error is "legit" because Swift MMIO in this case does/did actually use an array, reported here: https://github.com/apple/swift-mmio/issues/126
The thing to improve/fix is the quality of the diagnostic. It needs to point to the real location of the problem.
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:
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 6a5ae8d5df144dd) Target: x86_64-unknown-linux-gnu
Additional information
I also tested this with the Swift 6.0.1 release with the same result.