Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
cmd/compile: constant expression overflow doesn't report an error #42732
At tip (of dev.regabi) we now ICE instead, because of the failure to report an error message.
Relatedly, I realized I missed that XOR can also cause overflow, so this currently ICEs as well while trying to report the overflow error:
In the previous CL, I had incorrectly removed one of the error messages from issue20232.go, because I thought go/constant was just handling it. But actually the compiler was panicking in nodlit, because it didn't handle constant.Unknown. So this CL makes it leave n.Type == nil for unknown constant.Values. While here, also address #42732 by making sure to report an error message when origConst is called with an unknown constant.Value (as can happen when multiplying two floating-point constants overflows). Finally, add OXOR and OBITNOT to the list of operations to report errors about, since they're also constant expressions that can produce a constant with a greater bit length than their operands. Fixes #42732. Change-Id: I4a538fbae9b3ac4c553d7de5625dc0c87d9acce3 Reviewed-on: https://go-review.googlesource.com/c/go/+/272928 Trust: Matthew Dempsky <email@example.com> Run-TryBot: Matthew Dempsky <firstname.lastname@example.org> TryBot-Result: Go Bot <email@example.com> Reviewed-by: Russ Cox <firstname.lastname@example.org>