diff options
author | Chris Manghane <cmang@google.com> | 2015-01-07 16:14:50 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-01-07 16:14:50 +0000 |
commit | dd37378003635f34249819e39435a4f5cca90c8b (patch) | |
tree | 3f7d332f90846ff1b911ab7920f0e2269e0e1bde /gcc/go/go-gcc.cc | |
parent | 649a274903bed44696f204578da1dd3d5318458f (diff) | |
download | gcc-dd37378003635f34249819e39435a4f5cca90c8b.zip gcc-dd37378003635f34249819e39435a4f5cca90c8b.tar.gz gcc-dd37378003635f34249819e39435a4f5cca90c8b.tar.bz2 |
re PR go/61204 (gccgo: ICE in in fold_convert_loc [GoSmith])
PR go/61204
* go-gcc.cc (Gcc_backend::temporary_variable): Don't initialize
zero-sized variable.
From-SVN: r219316
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r-- | gcc/go/go-gcc.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 18c7146..1566552 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -2536,7 +2536,7 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock, BIND_EXPR_VARS(bind_tree) = BLOCK_VARS(block_tree); } - if (init_tree != NULL_TREE) + if (this->type_size(btype) != 0 && init_tree != NULL_TREE) DECL_INITIAL(var) = fold_convert_loc(location.gcc_location(), type_tree, init_tree); @@ -2546,6 +2546,13 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock, *pstatement = this->make_statement(build1_loc(location.gcc_location(), DECL_EXPR, void_type_node, var)); + + // Don't initialize VAR with BINIT, but still evaluate BINIT for + // its side effects. + if (this->type_size(btype) == 0 && init_tree != NULL_TREE) + *pstatement = this->compound_statement(this->expression_statement(binit), + *pstatement); + return new Bvariable(var); } |