Skip to content

cmd/compile: "bad code" with very large return value #20780

Closed

Description

@josharian
package p

type S struct {
	i interface {
		f() [107374100]int
	}
}

Compiling this with 1.9beta1 results in:

$ go tool compile x.go
compile: bad code

Same for 1.8.

Unlike its brethren, #20779 and #20778, the size of the return value here seems reasonable enough that it might be worth briefly investigating for 1.10, just in case.

Found by go-fuzz.

Activity

  1. added this to the Go1.10 milestone on Jun 24, 2017
  2. v47 commented on Jul 10, 2017

    @v47

    Error is coming from here src/cmd/internal/obj/pcln.go
    But in general, it's problem of offset, it's overflowing int32:

    <autogenerated>:1:0: offset too large in 00022 (<autogenerated>:1)      MOVQ    BP, -2147483656(SP)
    <autogenerated>:1:0: offset too large in 00030 (<autogenerated>:1)      LEAQ    -2147483656(SP), BP
    <autogenerated>:1:0: offset too large in 00096 (<autogenerated>:1)      MOVQ    DX, ""..autotmp_2-3221225472(SP)
    <autogenerated>:1:0: offset too large in 00109 (<autogenerated>:1)      LEAQ    ""..autotmp_2-3221225464(SP), DI
    <autogenerated>:1:0: offset too large in 00125 (<autogenerated>:1)      MOVQ    ""..autotmp_2-3221225472(SP), DX
    <autogenerated>:1:0: offset too large in 00149 (<autogenerated>:1)      LEAQ    ""..autotmp_2-3221225464(SP), SI
    <autogenerated>:1:0: offset too large in 00165 (<autogenerated>:1)      MOVQ    -2147483656(SP), BP
    
  3. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Nov 29, 2017
  4. bradfitz commented on Nov 29, 2017

    @bradfitz
    Contributor

    More detail at Go tip, but still present:

    bradfitz@gdev:~$ go version
    go version devel +992ce90 Wed Nov 29 03:24:52 2017 +0000 linux/amd64
    bradfitz@gdev:~$ go tool compile x.go
    <autogenerated>:1:0: overflow in spadj: 0 + 1717985616 = 1717985616
    compile: bad code
    

    It's been this way for 2 releases, so might as well be 3, sorry.

    /cc @mdempsky

  5. modified the milestones: Go1.10, Go1.11 on Nov 29, 2017
  6. gopherbot commented on May 29, 2018

    @gopherbot
    Contributor

    Change https://golang.org/cl/115195 mentions this issue: cmd/compile: include callee args section when checking frame too large

  7. locked and limited conversation to collaborators on Jun 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions