aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/parse.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-12-14 20:41:30 -0800
committerIan Lance Taylor <iant@golang.org>2020-12-15 12:56:50 -0800
commit8a5b8fc719f5c5bd6bd732d95646193238343f39 (patch)
treeeddea22d69c0152b414957227fac616c3d41c6b0 /gcc/go/gofrontend/parse.cc
parentf23753c710d54fdf6f6c6cbe93c5b0fdbf209fc8 (diff)
downloadgcc-8a5b8fc719f5c5bd6bd732d95646193238343f39.zip
gcc-8a5b8fc719f5c5bd6bd732d95646193238343f39.tar.gz
gcc-8a5b8fc719f5c5bd6bd732d95646193238343f39.tar.bz2
compiler: discard global sink variables with static initializers
This is specifically for the test fixedbugs/issue23781.go, which builds a large static array. The code does compile and work without this change, but it takes a long time and generates a large object file. Discarding the unnecessary static initializer makes this test much faster. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/278172
Diffstat (limited to 'gcc/go/gofrontend/parse.cc')
-rw-r--r--gcc/go/gofrontend/parse.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index a4740cf..3b2e5a7 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -2075,6 +2075,7 @@ Parse::create_dummy_global(Type* type, Expression* init,
if (type == NULL && init == NULL)
type = Type::lookup_bool_type();
Variable* var = new Variable(type, init, true, false, false, location);
+ var->set_is_global_sink();
static int count;
char buf[30];
snprintf(buf, sizeof buf, "_.%d", count);