https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65772
Ian Lance Taylor <ian at airs dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Ian Lance Taylor <ian at airs dot com> --- The test case is invalid. It works coincidentally with gc. The order of evaluation rules for Go (http://golang.org/ref/spec#Order_of_evaluation) do not specify when a variable is read. In a case like return files, filepath.Walk(dir, visit) where files is updated by the visit function passed to filepath.Walk, the files variable may be read either before or after calling filepath.Walk. The gc compiler is generating code that reads it after, the gccgo compiler is generating code that reads it before. Either is correct according to the language spec.