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

Closed
marigonzes opened this issue Apr 6, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@marigonzes
Copy link

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?

Yes.

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 GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-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.
https://play.golang.org/p/EK8zDu5vVQN

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.
https://play.golang.org/p/LM9TBaQcRIo

@ALTree

This comment has been minimized.

Copy link
Member

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.
You can’t perform that action at this time.