projects
/
platform
/
upstream
/
gcc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8629c99
)
Don't crash on redefined variable.
author
Ian Lance Taylor
<ian@gcc.gnu.org>
Thu, 10 Feb 2011 23:38:50 +0000
(23:38 +0000)
committer
Ian Lance Taylor
<ian@gcc.gnu.org>
Thu, 10 Feb 2011 23:38:50 +0000
(23:38 +0000)
From-SVN: r170029
gcc/go/gofrontend/parse.cc
patch
|
blob
|
history
diff --git
a/gcc/go/gofrontend/parse.cc
b/gcc/go/gofrontend/parse.cc
index 53414ebcb09cabda6f6874f1d22201771314cab4..45ff33df3d8406bba9246beacddd5c34dc1bdd7f 100644
(file)
--- a/
gcc/go/gofrontend/parse.cc
+++ b/
gcc/go/gofrontend/parse.cc
@@
-1848,7
+1848,13
@@
Parse::init_var(const Typed_identifier& tid, Type* type, Expression* init,
*is_new = true;
Variable* var = new Variable(type, init, this->gogo_->in_global_scope(),
false, false, location);
- return this->gogo_->add_variable(tid.name(), var);
+ Named_object* no = this->gogo_->add_variable(tid.name(), var);
+ if (!no->is_variable())
+ {
+ // The name is already defined, so we just gave an error.
+ return this->gogo_->add_sink();
+ }
+ return no;
}
// Create a dummy global variable to force an initializer to be run in