Skip to content

cmd/gc: offset 2147483649 too large for OINDREG #6036

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

Closed
bradfitz opened this issue Aug 4, 2013 · 4 comments
Closed

cmd/gc: offset 2147483649 too large for OINDREG #6036

bradfitz opened this issue Aug 4, 2013 · 4 comments
Milestone

Comments

@bradfitz
Copy link
Contributor

bradfitz commented Aug 4, 2013

This:

package main

func main() {
        var buf [1<<31]byte
        buf[len(buf)-1] = 0
}

generates:

large.go:3: stack frame too large (>2GB)

If that's too large, why isn't it just heap-promoted?





This works fine:

package main

var ptr *byte

func main() {
        var buf [1<<31]byte
        buf[len(buf)-1] = 0
        ptr = &buf[0]
}




But this:

package main

/*

*/
import "C"

import "unsafe"

func main() {
        var buf [1<<31 + 2]byte
        for i := range buf {
                buf[i] = 'a'
        }
        buf[len(buf)-1] = 0  // ERROR: offset 2147483649 too large for OINDREG
        println(len(C.GoString((*C.char)(unsafe.Pointer(&buf[0])))))
}

Yields: x.go:15: offset 2147483649 too large for OINDREG
@bradfitz
Copy link
Contributor Author

bradfitz commented Aug 8, 2013

Comment 1:

The first example above is now fixed by:
cmd/gc: move large stack variables to heap
https://code.google.com/p/go/source/detail?r=29b6246f5a9c 
But "offset 2147483649 too large for OINDREG" remains.

@bradfitz
Copy link
Contributor Author

bradfitz commented Aug 8, 2013

Comment 2:

That is:
package main
func main() {
        var buf [1<<31 + 2]byte
        buf[len(buf)-1] = 0  // ERROR: offset 2147483649 too large for OINDREG                                
}

@remyoudompheng
Copy link
Contributor

Comment 3:

https://golang.org/cl/12992043/

Status changed to Started.

@remyoudompheng
Copy link
Contributor

Comment 4:

This issue was closed by revision 9c21ce5.

Status changed to Fixed.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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

4 participants