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: panic: Non-SSAable value should be a named location: foo.rts #35213

Closed
mattn opened this issue Oct 28, 2019 · 2 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@mattn
Copy link
Member

mattn commented Oct 28, 2019

What version of Go are you using (go version)?

$ go version
go version devel +adef06c7a5 Mon Oct 28 12:35:06 2019 +0000 windows/amd64

Does this issue reproduce with the latest release?

No.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=auto
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\mattn\AppData\Local\go-build
set GOENV=C:\Users\mattn\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\mattn\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\dev\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\dev\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\mattn\AppData\Local\Temp\go-build784877526=/tmp/go-build -gno-record-gcc-switches

What did you do?

main.go

package main

/*
#include <stdlib.h>

typedef struct Point {
    int x;
    int y;
} Point;

typedef struct Points {
    Point* points;
	int length;
} Points;

typedef struct Rect {
    Points rts;
} Rect;

struct Rect X() {
  struct Rect foo;
  return foo;
}

void Y(Points ps) {
}
*/
import "C"

func main() {
	foo := C.X()
	defer C.Y(foo.rts)
}

Compiling this code

What did you expect to see?

Success to compile

What did you see instead?

# command-line-arguments
panic: Non-SSAable value should be a named location: foo.rts

goroutine 21 [running]:
cmd/compile/internal/gc.(*state).openDeferSave(0xc0002d2480, 0xc000319f00, 0xc00044ae40, 0xc0004988c0, 0xc000498700)
	C:/dev/go/src/cmd/compile/internal/gc/ssa.go:4184 +0x7a1
cmd/compile/internal/gc.(*state).openDeferRecord(0xc0002d2480, 0xc000319e80)
	C:/dev/go/src/cmd/compile/internal/gc/ssa.go:4130 +0x237
cmd/compile/internal/gc.(*state).stmt(0xc0002d2480, 0xc000319f80)
	C:/dev/go/src/cmd/compile/internal/gc/ssa.go:1080 +0x16f8
cmd/compile/internal/gc.(*state).stmtList(0xc0002d2480, 0xc00031a7e0)
	C:/dev/go/src/cmd/compile/internal/gc/ssa.go:1018 +0x5f
cmd/compile/internal/gc.buildssa(0xc0002b8dc0, 0x0, 0x0)
	C:/dev/go/src/cmd/compile/internal/gc/ssa.go:426 +0xc40
cmd/compile/internal/gc.compileSSA(0xc0002b8dc0, 0x0)
	C:/dev/go/src/cmd/compile/internal/gc/pgen.go:298 +0x64
cmd/compile/internal/gc.compileFunctions.func2(0xc000091500, 0xc00034ccb0, 0x0)
	C:/dev/go/src/cmd/compile/internal/gc/pgen.go:363 +0x50
created by cmd/compile/internal/gc.compileFunctions
	C:/dev/go/src/cmd/compile/internal/gc/pgen.go:361 +0x12f
@randall77
Copy link
Contributor

@danscales

@ianlancetaylor ianlancetaylor changed the title panic: Non-SSAable value should be a named location: foo.rts cmd/compile: panic: Non-SSAable value should be a named location: foo.rts Oct 28, 2019
@ianlancetaylor ianlancetaylor added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Oct 28, 2019
@ianlancetaylor ianlancetaylor added this to the Go1.14 milestone Oct 28, 2019
@danscales danscales self-assigned this Oct 28, 2019
@gopherbot
Copy link

Change https://golang.org/cl/203888 mentions this issue: cmd/compile: handle some missing cases of non-SSAable values for args of open-coded defers

@golang golang locked and limited conversation to collaborators Oct 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

5 participants