compiler: fix crashes on cyclic var/type references

This patch fixes type traversal to avoid compiler crashes for test
cases where a type T includes an expression that refers back to the
type without actually explicitly mentioning T. Examples include

  var x [uintptr(unsafe.Sizeof(&x))]byte
  var a [len(a)]int

The fix involves expanding the set of types that the traversal code
"remembers" (to avoid cycles) to include array types, and introducing an
additional guard in Builtin_call_expression::do_is_constant to catch
cyclic type constructs.

Fixes golang/go#25299
Fixes golang/go#25679
Fixes golang/go#25315
Fixes golang/go#25680

Change-Id: I9e9bfe4413e3ddd7ce611d5164dea36c165dd4c6
Reviewed-on: https://go-review.googlesource.com/115796
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 files changed