Commit 52e6d7c6 authored by Rémy Oudompheng's avatar Rémy Oudompheng

cmd/gc: use a register to checknil constants.

Fixes #7346.

LGTM=rsc
R=rsc, iant, khr
CC=golang-codereviews
https://golang.org/cl/69050044
parent 0a3bd045
......@@ -476,7 +476,7 @@ cgen_checknil(Node *n)
dump("checknil", n);
fatal("bad checknil");
}
if((thechar == '5' && n->op != OREGISTER) || !n->addable) {
if((thechar == '5' && n->op != OREGISTER) || !n->addable || n->op == OLITERAL) {
regalloc(&reg, types[tptr], n);
cgen(n, &reg);
gins(ACHECKNIL, &reg, N);
......
// compile
// Copyright 2014 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 7346 : internal error "doasm" error due to checknil
// of a nil literal.
package main
func main() {
_ = *(*int)(nil)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment