modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/nilptr4.go (about)

     1  // build
     2  
     3  // Copyright 2014 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  // Test that the compiler does not crash during compilation.
     8  
     9  package main
    10  
    11  import "unsafe"
    12  
    13  // Issue 7413
    14  func f1() {
    15  	type t struct {
    16  		i int
    17  	}
    18  
    19  	var v *t
    20  	_ = int(uintptr(unsafe.Pointer(&v.i)))
    21  	_ = int32(uintptr(unsafe.Pointer(&v.i)))
    22  }
    23  
    24  func main() {}