compiler: let initializers hold addresses of fields
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 27 Jan 2017 15:08:23 +0000 (15:08 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 27 Jan 2017 15:08:23 +0000 (15:08 +0000)
commit46f7b80ec41b680de9316dbdb3c9cfe376d8e88b
treea7ccb6363b9382bcc300d5b7ef9a3e7533e048d1
parent42f20102eff9b4e5cfad7cd21505a204df085418
compiler: let initializers hold addresses of fields

    The runtime.dbgvars initializer looks like

    var dbgvars = []dbgVar{
            {"allocfreetrace", &debug.allocfreetrace},
    }

    Because the field address was not recognized as valid for a static
    initializer, the variable was initialized at runtime.  Normally that
    would be fine, but for the runtime package it meant that dbgvars was
    not initialized when it was read by parsedebugvars.  That meant that
    the GODEBUG environment variable did nothing.

    Fixing that revealed that the static initializer checks had to be more
    careful about interface types, just like the existing is_constant
    methods.

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

From-SVN: r244982
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/expressions.h