Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: go build takes too long and creates huge executable with big static array #24724

marigonzes opened this issue Apr 6, 2018 · 1 comment


Copy link

@marigonzes marigonzes commented Apr 6, 2018

What version of Go are you using (go version)?

go version go1.10.1 windows/amd64

Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_CFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=...

What did you do and what happened?

I'm learning Go and I decided to make a few little programs to get comfortable with the language. Usually the executables are ~1MB. But when I tried to compile the following program, the compilation took a long time and the executable was ~800MB.

What did you expect to see?

I expected the executable to be ~1MB, because I tried a similar program, but without the explicit initialization of the first element of the array to 1, and it worked fine. Like the other times, the executable was ~1MB.


This comment has been minimized.

Copy link

@ALTree ALTree commented Apr 6, 2018

Thanks for the report.

This is a duplicate of issue #17378 (cmd/compile: large arrays cause large binaries and toolchain errors); so I'm closing this thread in favour of the old one.

@ALTree ALTree closed this Apr 6, 2018
@ALTree ALTree changed the title 'go build' takes too long and creates huge executable cmd/compile: go build takes too long and creates huge executable with big static array Apr 6, 2018
@golang golang locked and limited conversation to collaborators Apr 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.