Repository: go
Issue: cmd/compile: DWARF duplicated DW_TAG_formal_parameter for some functions
Labels: NeedsInvestigation,Debugging,compiler/runtime

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.20.4 linux/amd64
</pre>

I can duplicate this starting with 1.18.  Binary produced with go 1.17 doesn't seem to show this issue.

Cross compiling to arm64 (instead of amd64) also shows the same issue.

### Does this issue reproduce with the latest release?

Yes

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GOARCH="amd64"
GOOS="linux"
</pre></details>

### What did you do?

<pre>
package main

import "fmt"

func main() {
	fmt.Println("Hello")
}
</pre>

<pre>
readelf -wi hello | less
search for the "internal/poll.(*FD).Write" DW_TAG_subprogram entry
</pre>


### What did you expect to see?

Expected to see a subprogram entry with 4 DW_TAG_formal_parameter params (fd, p, ~r0, ~r1)


### What did you see instead?

Th ~r0 and ~r1 formal params elements were duplicated:

<pre>
 <1><a272>: Abbrev Number: 3 (DW_TAG_subprogram)
    <a273>   DW_AT_name        : internal/poll.(*FD).Write
    <a28d>   DW_AT_low_pc      : 0x4783e0
    <a295>   DW_AT_high_pc     : 0x4788e9
    <a29d>   DW_AT_frame_base  : 1 byte block: 9c       (DW_OP_call_frame_cfa)
    <a29f>   DW_AT_decl_file   : 0x5
    <a2a3>   DW_AT_external    : 1
 <2><a2a4>: Abbrev Number: 18 (DW_TAG_formal_parameter)
    <a2a5>   DW_AT_name        : fd
    <a2a8>   DW_AT_variable_parameter: 0
    <a2a9>   DW_AT_decl_line   : 369
    <a2ab>   DW_AT_type        : <0x7da43>
    <a2af>   DW_AT_location    : 0x1492a (location list)
 <2><a2b3>: Abbrev Number: 18 (DW_TAG_formal_parameter)
    <a2b4>   DW_AT_name        : p
    <a2b6>   DW_AT_variable_parameter: 0
    <a2b7>   DW_AT_decl_line   : 369
    <a2b9>   DW_AT_type        : <0x6af98>
    <a2bd>   DW_AT_location    : 0x14970 (location list)
 <2><a2c1>: Abbrev Number: 17 (DW_TAG_formal_parameter)     ***1st ~r0***
    <a2c2>   DW_AT_name        : ~r0
    <a2c6>   DW_AT_variable_parameter: 1
    <a2c7>   DW_AT_decl_line   : 369
    <a2c9>   DW_AT_type        : <0x698f1>
    <a2cd>   DW_AT_location    : 0 byte block:  ()
 <2><a2ce>: Abbrev Number: 17 (DW_TAG_formal_parameter)     ***2nd ~r0***
    <a2cf>   DW_AT_name        : ~r0
    <a2d3>   DW_AT_variable_parameter: 1
    <a2d4>   DW_AT_decl_line   : 369
    <a2d6>   DW_AT_type        : <0x698f1>
    <a2da>   DW_AT_location    : 0 byte block:  ()
 <2><a2db>: Abbrev Number: 17 (DW_TAG_formal_parameter)    ***1st ~r1***
    <a2dc>   DW_AT_name        : ~r1
    <a2e0>   DW_AT_variable_parameter: 1
    <a2e1>   DW_AT_decl_line   : 369
    <a2e3>   DW_AT_type        : <0x740bc>
    <a2e7>   DW_AT_location    : 0 byte block:  ()
 <2><a2e8>: Abbrev Number: 17 (DW_TAG_formal_parameter)    ***2nd ~r1***
    <a2e9>   DW_AT_name        : ~r1
    <a2ed>   DW_AT_variable_parameter: 1
    <a2ee>   DW_AT_decl_line   : 369
    <a2f0>   DW_AT_type        : <0x740bc>
    <a2f4>   DW_AT_location    : 0 byte block:  ()
.....
</pre>