Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(150)

Side by Side Diff: src/cmd/gc/unsafe.c

Issue 5432082: code review 5432082: gc: keep pointer to original node in constant rewrites. (Closed)
Patch Set: diff -r b854cc52d41e https://go.googlecode.com/hg/ Created 13 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cmd/gc/const.c ('k') | test/fixedbugs/bug379.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 #include <u.h> 5 #include <u.h>
6 #include <libc.h> 6 #include <libc.h>
7 #include "go.h" 7 #include "go.h"
8 8
9 /* 9 /*
10 * look for 10 * look for
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 yes: 88 yes:
89 if(args->next != nil) 89 if(args->next != nil)
90 yyerror("extra arguments for %S", s); 90 yyerror("extra arguments for %S", s);
91 ret: 91 ret:
92 // any side effects disappear; ignore init 92 // any side effects disappear; ignore init
93 val.ctype = CTINT; 93 val.ctype = CTINT;
94 val.u.xval = mal(sizeof(*n->val.u.xval)); 94 val.u.xval = mal(sizeof(*n->val.u.xval));
95 mpmovecfix(val.u.xval, v); 95 mpmovecfix(val.u.xval, v);
96 n = nod(OLITERAL, N, N); 96 n = nod(OLITERAL, N, N);
97 n->orig = nn;
97 n->val = val; 98 n->val = val;
98 n->type = types[TUINTPTR]; 99 n->type = types[TUINTPTR];
100 nn->type = types[TUINTPTR];
99 return n; 101 return n;
100 } 102 }
101 103
102 int 104 int
103 isunsafebuiltin(Node *n) 105 isunsafebuiltin(Node *n)
104 { 106 {
105 if(n == N || n->op != ONAME || n->sym == S || n->sym->pkg != unsafepkg) 107 if(n == N || n->op != ONAME || n->sym == S || n->sym->pkg != unsafepkg)
106 return 0; 108 return 0;
107 if(strcmp(n->sym->name, "Sizeof") == 0) 109 if(strcmp(n->sym->name, "Sizeof") == 0)
108 return 1; 110 return 1;
109 if(strcmp(n->sym->name, "Offsetof") == 0) 111 if(strcmp(n->sym->name, "Offsetof") == 0)
110 return 1; 112 return 1;
111 if(strcmp(n->sym->name, "Alignof") == 0) 113 if(strcmp(n->sym->name, "Alignof") == 0)
112 return 1; 114 return 1;
113 return 0; 115 return 0;
114 } 116 }
OLDNEW
« no previous file with comments | « src/cmd/gc/const.c ('k') | test/fixedbugs/bug379.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b