From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3985 invoked by alias); 10 Dec 2014 19:39:09 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 3522 invoked by uid 48); 10 Dec 2014 19:39:04 -0000 From: "cmang at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug go/61204] gccgo: ICE in in fold_convert_loc [GoSmith] Date: Wed, 10 Dec 2014 19:39:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: go X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cmang at google dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ian at airs dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc everconfirmed Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-12/txt/msg01186.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61204 Chris Manghane 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 --- 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);