https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61204
Chris Manghane <cmang at google dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2014-12-10
CC| |cmang at google dot com
Ever confirmed|0 |1
--- Comment #1 from Chris Manghane <cmang at google dot com> ---
This smaller version of this program is:
package main
func main() {
type t [0]int
var v t
v, _ = [0]int{}, 0
_ = v
}
which fails because [0]int is a zero-sized type and the temporary variable for
that holds [0]int{} cannot be initialized. This patch avoids initializing
zero-sized temporaries:
Index: gcc/go/go-gcc.cc
======================================================================
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -2505,7 +2505,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);