Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: fatal error: out of memory on reslice with negative index #28797
What version of Go are you using (
changed the title
runtime: fatal error: out of memory on reslice with negative index
Nov 28, 2018
@randall77, wouldn't mind your opinion on this.
and we generate code based on that assumption, using an unsigned comparison -- this will fail if AX below happens to be a negative number (and of course it is).
The source code is
I think our two choices for fixing this are either to remove the assumption from prove, or in ssa.go to catch the case where arg1 of OpIsSliceInBounds might be negative and explicitly check for that.
I favor the explicit extra check, since as it happens we compile this to code that would not do the correct thing if fed a negative number. Here's another test case making the trick more explicit:
One possibility for improving code for the unoptimized case is to only insert the extra explicit test when phase "prove" is enabled.