Repository: go
Issue: cmd/compile: DWARF Incorrect slice len
Labels: NeedsInvestigation,compiler/runtime

<!--
Please answer these questions before submitting your issue. Thanks!
For questions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.17.1 linux/amd64
</pre>

### Does this issue reproduce with the latest release?
No, this issue appeared after 1.14.9


### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mahdi/.cache/go-build"
GOENV="/home/mahdi/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/mahdi/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/mahdi/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/mahdi/go1.17.1/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/mahdi/go1.17.1/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.1"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build271877701=/tmp/go-build -gno-record-gcc-switches"
</pre></details>

### What did you do?

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->
Consider below source code:
```
package main

import "fmt"

// Create a new type of 'deck' which is a slice of strings
type deck []string

func newDeck() deck {
	cards := deck{}

	cardSuits := []string{"Spades", "Diamonds", "Hearts", "Clubs"}
	cardValues := []string{"Ace", "Two", "Three", "Four"}

	for _, suit := range cardSuits {
		for _, value := range cardValues {
			cards = append(cards, value+" of "+suit)
		}
	}
	
	return cards
}

func (d deck) print() {
	for i, card := range d {
		fmt.Println(i, card)
	}
}

func main() {

	cards := newDeck()

	cards.print()
}

```
Now, compile the code and run debugger on final exe. set breakpoint on line 12 of `newDeck` function and then try to see the local variable: 
```
go build deck.go
dlv exec ./deck
(dlv) break main.newDeck:12
```

### What did you expect to see?
the slice length is 16 and I expect to see this after running `locals` commad:
`cards = main.deck len: 16, cap: 16, [...]`


### What did you see instead?
`cards = main.deck len: 15, cap: 16, [...]`

There is also an interesting behavior here. If you try to print the length of that slice the debugger shows the length correctly:
```
    15:                 for _, value := range cardValues {
    16:                         cards = append(cards, value+" of "+suit)
    17:                 }
    18:         }
    19:         println("cards len=", len(cards))
=>  20:         return cards
    21: }
    22:
    23: func (d deck) print() {
    24:         for i, card := range d {
    25:                 fmt.Println(i, card)
(dlv) locals
cards = main.deck len: 16, cap: 16, [...]
cardSuits = (unreadable empty OP stack)
cardValues = (unreadable empty OP stack)
```