https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93866

            Bug ID: 93866
           Summary: [debug] Methods with pointer receiver incorrectly
                    named
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
          Assignee: ian at airs dot com
          Reporter: vries at gcc dot gnu.org
                CC: cmang at google dot com
  Target Milestone: ---

Consider methods.go from the gdb testsuite:
...
$ cat gdb/testsuite/gdb.go/methods.go      
package main

import "fmt"

type T struct { i int }

func (t T) Foo () {
  fmt.Println (t.i)
}

func (t *T) Bar () {
  fmt.Println (t.i)
}

func main () {
  fmt.Println ("Shall we?")
  var t T
  t.Foo ()
  var pt = new (T)
  pt.Bar ()
}
...

With go1.11.13, we have:
...
$ nm methods | egrep "\.Bar"
000000000049c750 T main.(*T).Bar
...
and:
...
$ readelf -wi methods | egrep "\.Bar"
    <6c49b>   DW_AT_name        : main.(*T).Bar
...

In contrast, with gccgo-10, we have:
...
$ nm methods | egrep "\.Bar"
0000000000402c8d T main.T.Bar
...
and:
...
$ readelf -wi methods | egrep "\.Bar"
    <1df4>   DW_AT_name        : main.Bar..1main.T
    <1dfb>   DW_AT_linkage_name: main.T.Bar
...

At https://golang.org/doc/gdb, we read:
...
Methods must be qualified with the name of their receiver types. For example,
the *Regexp type’s String method is known as 'regexp.(*Regexp).String'. 
...

That sounds like what go1.11.13 emits is correct, and what gccgo-10 emits is
not.

Reply via email to