compiler: fix crashes on cyclic var/type references
commit54934d771c017fbb3a12b0737c3ebca4471962c8
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Jun 2018 19:10:05 +0000 (4 19:10 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Jun 2018 19:10:05 +0000 (4 19:10 +0000)
treebac6ab9a7cb11017d4e4ab53577eebb573d2e3dc
parent702e42ae7cc79236250f0e62253c53d2b050c585
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

    Reviewed-on: https://go-review.googlesource.com/115796

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261168 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/gogo.cc