]> Cypherpunks.ru repositories - gostls13.git/blob - test/fixedbugs/issue59293.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / fixedbugs / issue59293.go
1 // run
2
3 // Copyright 2023 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 package main
8
9 import "unsafe"
10
11 //go:noinline
12 func f(x []byte) bool {
13         return unsafe.SliceData(x) != nil
14 }
15
16 //go:noinline
17 func g(x string) bool {
18         return unsafe.StringData(x) != nil
19 }
20
21 func main() {
22         if f(nil) {
23                 panic("bad f")
24         }
25         if g("") {
26                 panic("bad g")
27         }
28 }