<pre class="notranslate">What steps will reproduce the problem?
This simple code reveals an infinite print loop: 
package main 
import "fmt" 
import "log" 
import "runtime/debug" 
var count = 0 
type foo struct { 
  i int 
} 

func (f foo) String() string { 
  count++ 
  if count &gt; 10 { 
    debug.PrintStack() 
    panic("call stack too large") 
  } 
  return fmt.Sprintf("foo@%p value: %d", f, f.i) 
} 

func main() { 
  f := foo{i: 3} 
  // ok 
  log.Println(fmt.Sprintf("foo@%p value: %d", &amp;f, f.i)) 
  // inf loop 
  log.Printf("foo@%p, value: %d\n", f, f.i) 
} 

If you take out the loop protection in the code, you will end up crashing with no system
memory left.

What is the expected output?
There should be a callstack protection so that the program wouldn't chew up all the
system memories.

What do you see instead?
hang and eat up all the memories.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g, 8g

Which operating system are you using?
Linux 386/amd64

Which revision are you using?  (hg identify)
tip

Please provide any additional information below.

Ian's comment:

I think we should use the depth we are already passing down to catch 
this kind of loop before we eat all of memory.</pre>
<p dir="auto">by <strong>mddkpp</strong>:</p>
<pre class="notranslate">1. What is a short input program that triggers the error?

package main

import "fmt"

type A [10]int

var a A

func main() {
    a.pp()

    b := &amp;a
    c := &amp;b

    c.pp() // or just use (&amp;(&amp;a)).pp()
}

func (a A) pp() { fmt.Printf("%#v \n", a) }


2. What is the full compiler output?

bb.go:15: internal compiler error: method mismatch: A for **A

Please file a bug report including a short program that triggers the error.
<a href="http://code.google.com/p/go/issues/entry?template=compilerbug" rel="nofollow">http://code.google.com/p/go/issues/entry?template=compilerbug</a>

3. What version of the compiler are you using?  (Run it with the -V flag.)

8g version release.r60.3 9516

(Note the program should return an error)</pre>