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: internal compiler error: fault (due to long string) #1700

Closed
gopherbot opened this issue Apr 14, 2011 · 15 comments
Closed

cmd/compile: internal compiler error: fault (due to long string) #1700

gopherbot opened this issue Apr 14, 2011 · 15 comments

Comments

@gopherbot
Copy link

by gynvael@google.com:

1. What is a short input program that triggers the error?
package main

func main() {

  print("---> very large (e.g. 2GB) string here <---")
}

2. What is the full compiler output?
> 6g a1.go 
a1.go:11: internal compiler error: fault

Please file a bug report including a short program that triggers the error.
http://code.google.com/p/go/issues/entry?template=compilerbug


3. What version of the compiler are you using?  (Run it with the -V flag.)
6g version release.2011-03-07 7666


4. Dump from GDB:

Program received signal SIGSEGV, Segmentation fault.
_wordcopy_fwd_aligned (dstp=7237624, srcp=<value optimized out>, len=134199024) at
wordcopy.c:101
101 wordcopy.c: No such file or directory.
    in wordcopy.c
(gdb) where
#0  _wordcopy_fwd_aligned (dstp=7237624, srcp=<value optimized out>,
len=134199024) at wordcopy.c:101
#1  0x00007ffff785c852 in memmove (dest=0x6c2780, src=<value optimized out>,
len=1073741824) at memmove.c:73
#2  0x0000000000426046 in remal (p=0x7fff779cd010, on=1073741824, n=1073741824) at
/usr/include/bits/string3.h:59
#3  0x0000000000438685 in _yylex () at /go_lang/go/src/cmd/gc/lex.c:662
#4  yylex () at /go_lang/go/src/cmd/gc/lex.c:1270
#5  0x0000000000432965 in yyparse () at y.tab.c:2231
#6  0x000000000043794a in p9main (argc=1, argv=<value optimized out>)
    at /go_lang/go/src/cmd/gc/lex.c:225
#7  0x000000000043de99 in main (argc=7237624, argv=0x7fff779f1890)
    at /go_lang/go/src/lib9/main.c:35
(gdb) info reg
rax            0x6161616161616161   7016996765293437281
rbx            0x7fff779cd010   140735200153616
rcx            0x6161616161616161   7016996765293437281
rdx            0x7ffb6f0    134199024
rsi            0x7fff779f1890   140735200303248
rdi            0x6e6ff8 7237624
rbp            0x6c2780 0x6c2780
rsp            0x7fffffffce88   0x7fffffffce88
r8             0x0  0
r9             0x200000 2097152
r10            0x0  0
r11            0x246    582
r12            0x6c2780 7088000
r13            0x40000000   1073741824
r14            0x7fffffffcf00   140737488342784
r15            0x7fffffffcf08   140737488342792
rip            0x7ffff785e17c   0x7ffff785e17c <_wordcopy_fwd_aligned+124>
eflags         0x10206  [ PF IF RF ]
cs             0x33 51
ss             0x2b 43
ds             0x0  0
es             0x0  0
fs             0x0  0
gs             0x0  0
(gdb) x/1i $rip
=> 0x7ffff785e17c <_wordcopy_fwd_aligned+124>: mov    QWORD PTR [rdi+0x8],rax
@rsc
Copy link
Contributor

rsc commented Apr 15, 2011

Comment 1:

If you want to fix this, feel free.
I think you will find that many things will not work
very well if you try to use data literals > 2GB in size.

Owner changed to @rsc.

Status changed to HelpWanted.

@rsc
Copy link
Contributor

rsc commented Apr 20, 2011

Comment 2:

Labels changed: added priority-low.

@lvdlvd
Copy link

lvdlvd commented Nov 7, 2011

Comment 3:

Labels changed: added compilerbug.

@rsc
Copy link
Contributor

rsc commented Nov 7, 2011

Comment 4:

This is super low priority.

@rsc
Copy link
Contributor

rsc commented Dec 9, 2011

Comment 5:

Labels changed: added priority-someday, removed priority-low.

@rsc
Copy link
Contributor

rsc commented Dec 12, 2011

Comment 6:

Labels changed: added priority-go1.

@lvdlvd
Copy link

lvdlvd commented Dec 13, 2011

Comment 7:

Owner changed to @lvdlvd.

@robpike
Copy link
Contributor

robpike commented Jan 13, 2012

Comment 8:

Owner changed to builder@golang.org.

@rsc
Copy link
Contributor

rsc commented Feb 11, 2012

Comment 10:

Did not mean to mark this Go1.

Labels changed: added priority-someday, removed priority-go1.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 11:

Labels changed: added repo-main.

@rsc
Copy link
Contributor

rsc commented Mar 3, 2014

Comment 12:

Adding Release=None to all Priority=Someday bugs.

Labels changed: added release-none.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/gc: internal compiler error: fault (due to long string) cmd/compile: internal compiler error: fault (due to long string) Jun 8, 2015
@samgd
Copy link

samgd commented Feb 18, 2016

go version go1.6 linux/amd64

Building the above program works with a 1GB string OK. However, its maximum resident set size was 62GB. A build containing a 2GB string was killed by the kernel when the system ran out of memory (104GB).

@minux
Copy link
Member

minux commented Feb 19, 2016 via email

@jeffallen
Copy link
Contributor

jeffallen commented Oct 27, 2017

With Go 1.9, I used https://play.golang.org/p/Hc8V87IGvU in order to create a 2.1 gig Go file (dominated by the giant string). When I tried to compile it, I got this:

$ go run make.go > it.go && go build -o it it.go
# command-line-arguments
go.string..gostring.2147483649.5b14759a4f6441a59fe6351af17a489a83683239df1af81a4f55ed61cf094a6b: initialize bounds (0 < 2147483649)
go.string..gostring.2147483649.5b14759a4f6441a59fe6351af17a489a83683239df1af81a4f55ed61cf094a6b: phase error: addr=0x804b5559 value+size=0x4b5558

Those are coming from the linker. I am now looking into what the next steps are to prevent sending input that is too big to the linker, so that we give a useful error message.

@gopherbot
Copy link
Author

Change https://golang.org/cl/74330 mentions this issue: cmd/compile: do not try to write strings > 2g

@golang golang locked and limited conversation to collaborators Nov 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants