
The division and remainder operations were lowered directly to LLVM IR. This is wrong however because the Go specification defines exactly what happens on a divide by zero or signed integer overflow and LLVM IR itself treats those cases as undefined behavior. Therefore, this commit implements divide by zero and signed integer overflow according to the Go specification. This does have an impact on the generated code, but it is surprisingly small. I've used the drivers repo to test the code before and after, and to my surprise most driver smoke tests are not changed at all. Those that are, have only a small increase in code size. At the same time, this change makes TinyGo more compliant to the Go specification.
68 строки
491 Б
Text
68 строки
491 Б
Text
string equality
|
|
true
|
|
false
|
|
false
|
|
true
|
|
string inequality
|
|
false
|
|
true
|
|
false
|
|
true
|
|
false
|
|
true
|
|
false
|
|
true
|
|
false
|
|
true
|
|
false
|
|
true
|
|
true
|
|
false
|
|
false
|
|
true
|
|
array equality
|
|
true
|
|
false
|
|
false
|
|
false
|
|
false
|
|
true
|
|
struct equality
|
|
true
|
|
false
|
|
false
|
|
false
|
|
false
|
|
true
|
|
true
|
|
true
|
|
blank fields in structs
|
|
true
|
|
false
|
|
true
|
|
false
|
|
complex numbers
|
|
true
|
|
false
|
|
false
|
|
false
|
|
true
|
|
true
|
|
false
|
|
false
|
|
false
|
|
true
|
|
true
|
|
true
|
|
shifts
|
|
true
|
|
true
|
|
true
|
|
true
|
|
true
|
|
true
|
|
true
|
|
constant number
|
|
0
|
|
-2147483648 / -1: -2147483648
|
|
-2147483648 % -1: 0
|