FAQ
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://go.googlecode.com/hg/


Description:
cmd/gc: fix wrong interaction between inlining and embedded builtins.

Fixes issue 3552.

Please review this at https://codereview.appspot.com/6866047/

Affected files:
M src/cmd/gc/dcl.c
M src/cmd/gc/fmt.c
M test/fixedbugs/issue3552.dir/one.go
M test/fixedbugs/issue3552.dir/two.go
M test/fixedbugs/issue3552.go
M test/run.go


Index: src/cmd/gc/dcl.c
===================================================================
--- a/src/cmd/gc/dcl.c
+++ b/src/cmd/gc/dcl.c
@@ -1013,6 +1013,8 @@

if(exportname(name))
n = newname(lookup(name));
+ else if(s->pkg == builtinpkg)
+ n = newname(pkglookup(name, importpkg));
else
n = newname(pkglookup(name, s->pkg));
n = nod(ODCLFIELD, n, oldname(s));
Index: src/cmd/gc/fmt.c
===================================================================
--- a/src/cmd/gc/fmt.c
+++ b/src/cmd/gc/fmt.c
@@ -534,8 +534,12 @@
p = s->name;

// exportname needs to see the name without the prefix too.
- if((fmtmode == FExp && !exportname(p)) || fmtmode == FDbg)
- return fmtprint(fp, "@\"%Z\".%s", s->pkg->path, p);
+ if((fmtmode == FExp && !exportname(p)) || fmtmode == FDbg) {
+ if(s->pkg != builtinpkg)
+ return fmtprint(fp, "@\"%Z\".%s", s->pkg->path, p);
+ else
+ return fmtprint(fp, "@\"\".%s", p);
+ }

return fmtstrcpy(fp, p);
}
Index: test/fixedbugs/issue3552.dir/one.go
===================================================================
rename from test/bugs/bug434.dir/one.go
rename to test/fixedbugs/issue3552.dir/one.go
Index: test/fixedbugs/issue3552.dir/two.go
===================================================================
rename from test/bugs/bug434.dir/two.go
rename to test/fixedbugs/issue3552.dir/two.go
Index: test/fixedbugs/issue3552.go
===================================================================
rename from test/bugs/bug434.go
rename to test/fixedbugs/issue3552.go
Index: test/run.go
===================================================================
--- a/test/run.go
+++ b/test/run.go
@@ -704,11 +704,10 @@
"fixedbugs/bug248.go": true, // combines errorcheckdir and rundir in
the same dir.
"fixedbugs/bug302.go": true, // tests both .$O and .a imports.
"fixedbugs/bug313.go": true, // errorcheckdir with failures in the
middle.
- "fixedbugs/bug345.go": true, // needs the appropriate flags in gc
invocation.
+ "fixedbugs/bug345.go": true, // broken
"fixedbugs/bug369.go": true, // needs compiler flags.
"fixedbugs/bug385_32.go": true, // arch-specific errors.
"fixedbugs/bug385_64.go": true, // arch-specific errors.
"fixedbugs/bug429.go": true,
"bugs/bug395.go": true,
- "bugs/bug434.go": true,
}

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedDec 3, '12 at 4:53p
activeDec 3, '12 at 10:18p
posts7
users2
websitegolang.org

2 users in discussion

Remyoudompheng: 5 posts Lvd: 2 posts

People

Translate

site design / logo © 2022 Grokbase