You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
CL 11252 introduces a vet check for integer comparisons. It has false positives when checking code like u > uint64(^uintptr(0)) where u is a uint64. This expression is always false when compiled for 64 bit machines but not for 32 bit machines. IIRC, something similar occurred for the suspicious shift vet check.
It would be nice if vet checks could inquire about types and values on a per-int-size basis.
go/types uses the host machine's integer size as a default. We could override that in vet and typecheck twice, once with 32 bit ints and once with 64 bit ints, but that would be expensive. Maybe there's a better way?
In general, such expressions can depend on other constant expressions (possibly via declared constants); some of the expressions are always true or false depending on platform. An easy way around type-checking twice is to provide a flag specifying the target platform (which we may not want). Otherwise I don't see an easy way around type-checking twice, and signaling an error only if it occurs for both platforms.