| 1 |
// compile |
| 2 |
|
| 3 |
// Copyright 2018 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 |
func f() { |
| 10 |
var s string |
| 11 |
var p, q bool |
| 12 |
s = "a" |
| 13 |
for p { |
| 14 |
p = false == (true != q) |
| 15 |
s = "" |
| 16 |
} |
| 17 |
_ = s == "bbb" |
| 18 |
} |
| 19 |
|
| 20 |
// Another case: load from negative offset of a symbol |
| 21 |
// in dead code (issue 30257). |
| 22 |
func g() { |
| 23 |
var i int |
| 24 |
var s string |
| 25 |
|
| 26 |
if true { |
| 27 |
s = "a" |
| 28 |
} |
| 29 |
|
| 30 |
if f := 0.0; -f < 0 { |
| 31 |
i = len(s[:4]) |
| 32 |
} |
| 33 |
|
| 34 |
_ = s[i-1:0] != "bb" && true |
| 35 |
} |