Source file test/fixedbugs/issue48916.go

     1  // compile
     2  
     3  // Copyright 2021 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  // Issue 48916: expand_calls pass crashes due to a (dead)
     8  // use of an OpInvalid value.
     9  
    10  package p
    11  
    12  type T struct {
    13  	num int64
    14  }
    15  
    16  func foo(vs map[T]struct{}, d T) error {
    17  	_, ok := vs[d]
    18  	if !ok {
    19  		return nil
    20  	}
    21  
    22  	switch d.num {
    23  	case 0:
    24  	case 1:
    25  	case 2:
    26  	case 3:
    27  	case 4:
    28  	case 5:
    29  	case 6:
    30  		var num float64
    31  		if num != 0 {
    32  			return nil
    33  		}
    34  	}
    35  
    36  	return nil
    37  }
    38  

View as plain text