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: type error in one function causes type error in another #19880

Closed
aclements opened this issue Apr 7, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@aclements
Copy link
Member

commented Apr 7, 2017

What did you do?

https://play.golang.org/p/pzXMJOe4rJ

What did you expect to see?

I expected to see just the type error in function a:

main.go:8: type T is not an expression

What did you see instead?

I also see a type error in function b:

main.go:8: type T is not an expression
main.go:12: invalid array bound len((composite literal).f)

If you fix the type error in function a, the error in b goes away.

Does this issue reproduce with the latest release (go1.8.1)?

Yes.

System details

go version go1.8 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/austin/r/go"
GORACE=""
GOROOT="/home/austin/.cache/gover/1.8"
GOTOOLDIR="/home/austin/.cache/gover/1.8/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build683604531=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
GOROOT/bin/go version: go version go1.8 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.8 X:framepointer
uname -sr: Linux 4.4.0-66-generic
Distributor ID:	Ubuntu
Description:	Ubuntu 14.04.5 LTS
Release:	14.04
Codename:	trusty
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Ubuntu EGLIBC 2.19-0ubuntu6.11) stable release version 2.19, by Roland McGrath et al.
gdb --version: GNU gdb (GDB) 7.9-gg19

/cc @griesemer

@gopherbot gopherbot closed this in 423e7e6 Apr 10, 2017

lparth added a commit to lparth/go that referenced this issue Apr 13, 2017

cmd/compile: skip array bounds errors when type is broken
This avoids false positives
like those found in golang#19880.

Fixes golang#19880

Change-Id: I583c16cc3c71e7462a72500db9ea2547c468f8c1
Reviewed-on: https://go-review.googlesource.com/40255
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

@golang golang locked and limited conversation to collaborators Apr 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.