diff options
Diffstat (limited to 'src/cmd/gc/subr.c')
-rw-r--r-- | src/cmd/gc/subr.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c index 649b8f542..c836b60f2 100644 --- a/src/cmd/gc/subr.c +++ b/src/cmd/gc/subr.c @@ -1529,13 +1529,19 @@ treecopy(Node *n) break; case ONONAME: - if(n->iota) { - m = nod(OIOTA, n, nodintconst(iota)); + if(n->sym == lookup("iota")) { + // Not sure yet whether this is the real iota, + // but make a copy of the Node* just in case, + // so that all the copies of this const definition + // don't have the same iota value. + m = nod(OXXX, N, N); + *m = *n; + m->iota = iota; break; } // fall through - case OLITERAL: case ONAME: + case OLITERAL: case OTYPE: m = n; break; |