-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/compile: "abc"[1] is not an ideal constant
"abc"[1] is not like 'b', in that -"abc"[1] is uint8 math, not ideal constant math. Delay the constantification until after ideal constant folding is over. Fixes #11370. Change-Id: Iba2fc00ca2455959e7bab8f4b8b4aac14b1f9858 Reviewed-on: https://go-review.googlesource.com/15740 Run-TryBot: Russ Cox <[email protected]> Reviewed-by: Russ Cox <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
- Loading branch information
1 parent
0da30d5
commit 26c7b4f
Showing
3 changed files
with
21 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// compile | ||
|
||
// Copyright 2015 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// issue 11370: cmd/compile: "0"[0] should not be a constant | ||
|
||
package p | ||
|
||
func main() { | ||
println(-"abc"[1] >> 1) | ||
} |