diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-08-27 19:06:59 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-08-27 19:06:59 +0000 |
commit | 31da952a49ef2861ee35786a3e41865ac259599c (patch) | |
tree | 0d00f5f3ee3e684213177e8eb0fba4954e1b391b /gcc/go/gofrontend/parse.cc | |
parent | a5e5ea0c074caec82857a5f62173e161ee6b1615 (diff) | |
download | gcc-31da952a49ef2861ee35786a3e41865ac259599c.zip gcc-31da952a49ef2861ee35786a3e41865ac259599c.tar.gz gcc-31da952a49ef2861ee35786a3e41865ac259599c.tar.bz2 |
compiler: Don't record dependencies of invalid redefinitions.
The gofrontend would crash when trying to find the initialization
order of a variable list where one of the listed variables was an
invalid redefinition of another in a call statement. This patch
fixes initialization from call statements to consider invalid
redefinitions before recording dependency information.
Fixes golang/go#11543.
Reviewed-on: https://go-review.googlesource.com/13895
From-SVN: r227276
Diffstat (limited to 'gcc/go/gofrontend/parse.cc')
-rw-r--r-- | gcc/go/gofrontend/parse.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 922473a..cc43776 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -1741,6 +1741,14 @@ Parse::init_vars_from_call(const Typed_identifier_list* vars, Type* type, first_var = no; else { + // If the current object is a redefinition of another object, we + // might have already recorded the dependency relationship between + // it and the first variable. Either way, an error will be + // reported for the redefinition and we don't need to properly + // record dependency information for an invalid program. + if (no->is_redefinition()) + continue; + // The subsequent vars have an implicit dependency on // the first one, so that everything gets initialized in // the right order and so that we detect cycles |