1
0
mirror of https://github.com/golang/go synced 2024-11-13 12:40:26 -07:00
go/test/retjmp.dir/main.go
Cherry Mui 67917c3d78 cmd/internal/obj: fix tail call in non-zero frame leaf function on MIPS and S390X
A "RET f(SB)" wasn't assembled correctly in a leaf function with
non-zero frame size. Follows CL 371034, for MIPS(32/64)(be/le)
and S390X. Other architectures seem to do it right. Add a test.

Change-Id: I41349a7ae9862b924f3a3de2bcb55b782061ce21
Reviewed-on: https://go-review.googlesource.com/c/go/+/371214
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2021-12-13 22:42:08 +00:00

39 lines
655 B
Go

// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func f()
func leaf()
func leaf2()
var f1called, f2called, f3called, f4called bool
func main() {
f()
if !f1called {
panic("f1 not called")
}
if !f2called {
panic("f2 not called")
}
leaf()
if !f3called {
panic("f3 not called")
}
leaf2()
if !f4called {
panic("f4 not called")
}
}
func f1() { f1called = true }
func f2() { f2called = true }
func f3() { f3called = true }
func f4() { f4called = true }
func unreachable() {
panic("unreachable function called")
}