Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for unsafeaddr (0.26 sec)

  1. test/fixedbugs/issue35073a.go

    // license that can be found in the LICENSE file.
    
    // Test that reflect.Value.UnsafeAddr/Pointer is handled
    // correctly by -d=checkptr
    
    package main
    
    import (
    	"reflect"
    	"unsafe"
    )
    
    func main() {
    	n := 10
    	m := make(map[string]string)
    
    	_ = unsafe.Pointer(reflect.ValueOf(&n).Elem().UnsafeAddr())
    	_ = unsafe.Pointer(reflect.ValueOf(&m).Elem().Pointer())
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 20 15:12:49 UTC 2023
    - 497 bytes
    - Viewed (0)
  2. test/fixedbugs/issue35073b.go

    // reflect.Value.UnsafeAddr/Pointer, even in checkptr mode.
    
    package main
    
    import (
    	"reflect"
    	"unsafe"
    )
    
    func main() {
    	n := 10                      // ERROR "moved to heap: n"
    	m := make(map[string]string) // ERROR "moved to heap: m" "make\(map\[string\]string\) escapes to heap"
    
    	_ = unsafe.Pointer(reflect.ValueOf(&n).Elem().UnsafeAddr()) // ERROR "inlining call"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 20 15:12:49 UTC 2023
    - 706 bytes
    - Viewed (0)
  3. test/escape_unsafe.go

    func arithMask() unsafe.Pointer {
    	var x [2]byte // ERROR "moved to heap: x"
    	return unsafe.Pointer(uintptr(unsafe.Pointer(&x[1])) &^ 1)
    }
    
    // (5) Conversion of the result of reflect.Value.Pointer or
    // reflect.Value.UnsafeAddr from uintptr to Pointer.
    
    // BAD: should be "leaking param: p to result ~r0 level=0$"
    func valuePointer(p *int) unsafe.Pointer { // ERROR "leaking param: p$"
    	return unsafe.Pointer(reflect.ValueOf(p).Pointer())
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 07 17:25:59 UTC 2022
    - 2.2K bytes
    - Viewed (0)
  4. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/unsafeptr/unsafeptr.go

    		}
    
    	case *ast.CallExpr:
    		// "(5) Conversion of the result of reflect.Value.Pointer or
    		// reflect.Value.UnsafeAddr from uintptr to Pointer."
    		if len(x.Args) != 0 {
    			break
    		}
    		sel, ok := x.Fun.(*ast.SelectorExpr)
    		if !ok {
    			break
    		}
    		switch sel.Sel.Name {
    		case "Pointer", "UnsafeAddr":
    			if analysisutil.IsNamedType(info.Types[sel.X].Type, "reflect", "Value") {
    				return true
    			}
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 4.7K bytes
    - Viewed (0)
  5. src/cmd/vendor/golang.org/x/tools/internal/typesinternal/types.go

    	v := reflect.ValueOf(conf).Elem()
    
    	f := v.FieldByName("go115UsesCgo")
    	if !f.IsValid() {
    		f = v.FieldByName("UsesCgo")
    		if !f.IsValid() {
    			return false
    		}
    	}
    
    	addr := unsafe.Pointer(f.UnsafeAddr())
    	*(*bool)(addr) = true
    
    	return true
    }
    
    // ReadGo116ErrorData extracts additional information from types.Error values
    // generated by Go version 1.16 and later: the error code, start position, and
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 1.4K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go

    		switch k {
    		case reflect.Array, reflect.Map, reflect.Slice, reflect.Struct:
    			return true
    		}
    		return false
    	}
    
    	if v1.CanAddr() && v2.CanAddr() && hard(v1.Kind()) {
    		addr1 := v1.UnsafeAddr()
    		addr2 := v2.UnsafeAddr()
    		if addr1 > addr2 {
    			// Canonicalize order to reduce number of entries in visited.
    			addr1, addr2 = addr2, addr1
    		}
    
    		// Short circuit if references are identical ...
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jul 20 17:18:42 UTC 2022
    - 10.8K bytes
    - Viewed (0)
  7. test/escape_reflect.go

    func uintptr1(x *int) uintptr { // ERROR "leaking param: x$"
    	v := reflect.ValueOf(x)
    	return v.Pointer()
    }
    
    func unsafeaddr(x *int) uintptr { // ERROR "leaking param: x$"
    	v := reflect.ValueOf(x).Elem()
    	return v.UnsafeAddr()
    }
    
    func ifacedata(x any) [2]uintptr { // ERROR "moved to heap: x"
    	v := reflect.ValueOf(&x).Elem()
    	return v.InterfaceData()
    }
    
    func can(x int) bool {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 18:50:24 UTC 2023
    - 13.1K bytes
    - Viewed (0)
  8. src/unsafe/unsafe.go

    //	u := uintptr(unsafe.Pointer(p))
    //	syscall.Syscall(SYS_READ, uintptr(fd), u, uintptr(n))
    //
    // (5) Conversion of the result of [reflect.Value.Pointer] or [reflect.Value.UnsafeAddr]
    // from uintptr to Pointer.
    //
    // Package reflect's Value methods named Pointer and UnsafeAddr return type uintptr
    // instead of unsafe.Pointer to keep callers from changing the result to an arbitrary
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 21 19:45:20 UTC 2024
    - 12.1K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/test/inl_test.go

    			"Value.MapRange",
    			"Value.OverflowComplex",
    			"Value.OverflowFloat",
    			"Value.OverflowInt",
    			"Value.OverflowUint",
    			"Value.String",
    			"Value.Type",
    			"Value.Uint",
    			"Value.UnsafeAddr",
    			"Value.pointer",
    			"add",
    			"align",
    			"flag.mustBe",
    			"flag.mustBeAssignable",
    			"flag.mustBeExported",
    			"flag.kind",
    			"flag.ro",
    		},
    		"regexp": {
    			"(*bitState).push",
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 09 04:07:57 UTC 2024
    - 10.7K bytes
    - Viewed (0)
  10. src/go/internal/gccgoimporter/testdata/v1reflect.gox

     func (v <type 1>) TryRecv () (x <type 1>, ok <type -15>);
     func (v <type 1>) TrySend (x <type 1>) <type -15>;
     func (v <type 1>) Type () <type 26>;
     func (v <type 1>) Uint () <type -8>;
     func (v <type 1>) UnsafeAddr () <type -13>;
     func (v <type 1>) .reflect.assignTo (context <type -16>, dst <type 3>, target <type 57 *<type 58 interface { }>>) <type 1>;
    >, x ...<type 1>) <type 1>;
    func AppendSlice (s <type 1>, t <type 1>) <type 1>;
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Sep 30 21:33:51 UTC 2021
    - 10.3K bytes
    - Viewed (0)
Back to top