]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: fix runtime print(hex(x))
authorRuss Cox <rsc@golang.org>
Tue, 2 Sep 2014 18:36:25 +0000 (14:36 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 2 Sep 2014 18:36:25 +0000 (14:36 -0400)
The code I wrote originally works for trivial functions
that are inlined at a call site in another package,
because that was how I wrote my local test.
Make hex(x) work for non-inlinable functions too.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://golang.org/cl/140830043

src/cmd/gc/walk.c

index 26d8011240fbdeaf57f7b2302722a8f8a1c234c3..30c139200b8ffffa5d80142a0a2981c6948688a8 100644 (file)
@@ -1838,7 +1838,7 @@ walkprint(Node *nn, NodeList **init, int defer)
                                }
                        } else {
                                if(et == TUINT64) {
-                                       if(t->sym->pkg == runtimepkg && strcmp(t->sym->name, "hex") == 0)
+                                       if((t->sym->pkg == runtimepkg || compiling_runtime) && strcmp(t->sym->name, "hex") == 0)
                                                on = syslook("printhex", 0);
                                        else
                                                on = syslook("printuint", 0);