Skip to content

cmd/compile: dev.typeparams commit 0a0e3a3 broke dev.boringcrypto; fixed again at a72a499 #47227

Closed

Description

@mdempsky

Merging 0a0e3a3 into dev.boringcrypto causes make.bash to fail due to:

Building Go toolchain2 using go_bootstrap and Go toolchain1.
# crypto/internal/boring
<autogenerated>:1: internal compiler error: offset for r1 at $WORK/b060/_cgo_gotypes.go:842:75 changed from 8 to 0

This build failure was fixed a few commits later at a72a499.

That later commit was just an optimization, so it shouldn't be essential to correctly handling compiling this code. It would be good to get a minimal, standalone reproducer for what failed and add it as a compiler regress test.

To reproduce the issue:

  1. Checkout dev.boringcrypto.
  2. Run git merge 0a0e3a3
  3. Run ./make.bash in src.

/cc @cherrymui @cuonglm

Activity

  1. added
    SuggestedIssues that may be good for new contributors looking for work to do.
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Jul 15, 2021
  2. added this to the Unplanned milestone on Jul 15, 2021
  3. cuonglm commented on Jul 16, 2021

    @cuonglm
    Member

    I haven't looked deeper, but here's a simple reproducer:

    package p
    
    // static void f(int i) {}
    import "C"
    
    func f() {
    	defer C.f(C.int(1))
    }
    

    Just checkout commit 0a0e3a3 on dev.typeparams.

  4. gopherbot commented on Jul 16, 2021

    @gopherbot
    Contributor

    Change https://golang.org/cl/334882 mentions this issue: [dev.typeparams] test: add regression test for go/defer wrapper

  5. self-assigned this
    on Jul 16, 2021
  6. gopherbot commented on Jul 17, 2021

    @gopherbot
    Contributor

    Change https://golang.org/cl/334883 mentions this issue: [dev.typeparams] cmd/compile: make ssagen analyze ABI correctly for static function value

  7. cuonglm commented on Jul 17, 2021

    @cuonglm
    Member

    @mdempsky @cherrymui So the problem is not related to 0a0e3a3 and a72a499. This failed to compile even with current dev.typeparams tip:

    $ cat _cgo_gotypes.go
    package p
    
    //go:cgo_unsafe_args
    func g(*int) (r1 struct{}) {
    	return
    }
    
    func f() {
    	x := g
    	defer x(new(int))
    }
    

    The problem is that ssagen/ssa.go:state.call does't handle direct function value, so it use the wrong ABI to set the offset, which causes offset changed.

  8. gopherbot commented on Jul 22, 2021

    @gopherbot
    Contributor

    Change https://golang.org/cl/336629 mentions this issue: cmd/compile: do not change field offset in ABI analysis

  9. gopherbot commented on Jul 22, 2021

    @gopherbot
    Contributor

    Change https://golang.org/cl/336610 mentions this issue: [dev.typeparams] cmd/compile: remove outdate TODO in escape analysis

  10. locked and limited conversation to collaborators on Jun 23, 2023
  11. added a commit that references this issue on Apr 29, 2024
    052da57
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.SuggestedIssues that may be good for new contributors looking for work to do.help wanted

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions