diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-01-07 16:14:50 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-01-07 16:14:50 +0000 |
commit | 6b05931816244b5cfa7a0f2c5873cdea17a70809 (patch) | |
tree | 3f7d332f90846ff1b911ab7920f0e2269e0e1bde /gcc/go | |
parent | 32b738a5f23b63ad289fb76f2c42b476d9898cbe (diff) | |
download | gcc-6b05931816244b5cfa7a0f2c5873cdea17a70809.tar.gz |
PR go/61204
* go-gcc.cc (Gcc_backend::temporary_variable): Don't initialize
zero-sized variable.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219316 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/go/go-gcc.cc | 9 |
2 files changed, 19 insertions, 5 deletions
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index dba995c1f0e..bc952150582 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,7 +1,14 @@ +2015-01-07 Chris Manghane <cmang@google.com> + + PR go/61204 + * go-gcc.cc (Gcc_backend::temporary_variable): Don't initialize + zero-sized variable. + 2015-01-06 Chris Manghane <cmang@google.com> - * go-gcc.cc (constructor_expression): Don't initialize zero-sized - fields, just evaluate the values for side effects. + * go-gcc.cc (Gcc_backend::constructor_expression): Don't + initialize zero-sized fields, just evaluate the values for side + effects. 2015-01-05 Jakub Jelinek <jakub@redhat.com> @@ -11,8 +18,8 @@ 2014-12-19 Chris Manghane <cmang@google.com> - * go-gcc.cc (array_constructor_expression): Don't construct arrays - of zero-sized values. + * go-gcc.cc (Gcc_backend::array_constructor_expression): Don't + construct arrays of zero-sized values. 2014-10-29 Richard Sandiford <richard.sandiford@arm.com> diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 18c7146baf6..1566552cea6 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); } |