mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 02:57:46 +00:00
compiler: implement spec-compliant shifts
Previously, the compiler used LLVM's shift instructions directly, which have UB whenever the shifts are large or negative. This commit adds runtime checks for negative shifts, and handles oversized shifts.
This commit is contained in:
@@ -47,6 +47,11 @@ func chanMakePanic() {
|
||||
runtimePanic("new channel is too big")
|
||||
}
|
||||
|
||||
// Panic when a shift value is negative.
|
||||
func negativeShiftPanic() {
|
||||
runtimePanic("negative shift")
|
||||
}
|
||||
|
||||
func blockingPanic() {
|
||||
runtimePanic("trying to do blocking operation in exported function")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user