diff options
author | Ayke van Laethem <[email protected]> | 2020-06-30 15:59:17 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2020-06-30 17:56:10 +0200 |
commit | acb3cfba6d2775598b923e502c64c4b13b2ec9ce (patch) | |
tree | b07842887ece1bd28e66cb0d1c8587fc799a8866 | |
parent | 8cfc4005d3d31b5b4f36c08e005e9226d68380b6 (diff) | |
download | tinygo-acb3cfba6d2775598b923e502c64c4b13b2ec9ce.tar.gz tinygo-acb3cfba6d2775598b923e502c64c4b13b2ec9ce.zip |
avr: work around codegen bug in LLVM 10
Commit fc4857e98c (runtime: avoid recursion in printuint64 function)
caused a regression for AVR. I have tried locally with LLVM 11 (which
contains a number of codegen bugs) and the issue is no longer present,
so I'm assuming it's a codegen bug that is now fixed. However, LLVM 11
is not yet released so it seems best to me to work around this
temporarily (for the next few months).
This commit can easily be reverted when we start using LLVM 11.
-rw-r--r-- | src/runtime/print.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/runtime/print.go b/src/runtime/print.go index e4d715176..706904fbd 100644 --- a/src/runtime/print.go +++ b/src/runtime/print.go @@ -48,6 +48,16 @@ func printint16(n int16) { } func printuint32(n uint32) { + if TargetBits == 8 { + // AVR-specific workaround on LLVM 10. Should be removed when we switch + // to LLVM 11. + prevdigits := n / 10 + if prevdigits != 0 { + printuint32(prevdigits) + } + putchar(byte((n % 10) + '0')) + return + } printuint64(uint64(n)) } |