From patchwork Tue May 3 19:28:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 618128 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qzrnm4jLRz9t66 for ; Wed, 4 May 2016 05:28:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Sug8nCKF; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=xXukresODY//Jpm8zu3S7m7fxfb1aL8hVoXeR9VkPUheXWDAXq7Kl 4pzza/Wnf/T0pLouORxjI7rNSfPbHiLh/gMhupRPHj4SKcEr9v4N4AuWy0s2uYXL CEn4XZmgk6FX63zQ0jr+oYYaqq4NvbwSl87HjK1N+k61daBGR7NJjY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=rD6QHNniLYfk3kU4fIiC2TRRK0Q=; b=Sug8nCKFPHTVTbmvbozP dgedI/JeNVldRiFul5t2fN431hUjBdUr9gWyuJjZ2a4KN9A7dV8m1IlRlQSUpzmL N+63Ro8VJ2vt3rNSvf19osPuOHzhuwgxkkUugBRWqrRLXb7BuBc4WfrJ8zNoo21J 7BpdB7wXMe0sH2NXoRbsIws= Received: (qmail 41911 invoked by alias); 3 May 2016 19:28:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 41896 invoked by uid 89); 3 May 2016 19:28:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1364, calle X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 03 May 2016 19:28:48 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id AFC015454F7; Tue, 3 May 2016 21:28:44 +0200 (CEST) Date: Tue, 3 May 2016 21:28:44 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, rguenther@suse.de Subject: Fix tree-inlinine ICE with uninitializer return value Message-ID: <20160503192844.GA57857@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi, the code path handling the case where callee is missing return statement but calle statement has LHS is broken in tree-inline since anonymous SSA_NAMEs was introduced. This code is not not used because all those inlines are disabled by gimple_check_call_matching_types, but since I would like to drop the checks it seems good idea to fix the code path rather than dropping it. This copies what Jakub's code does when redirecting to unreachable. Bootstrapped/regtesetd x86_64-linux, OK? Honza * tree-inline.c (expand_call_inline): Fix path inlining function with no return statement. Index: tree-inline.c =================================================================== --- tree-inline.c (revision 235839) +++ tree-inline.c (working copy) @@ -4708,7 +4708,7 @@ expand_call_inline (basic_block bb, gimp { tree name = gimple_call_lhs (stmt); tree var = SSA_NAME_VAR (name); - tree def = ssa_default_def (cfun, var); + tree def = var ? ssa_default_def (cfun, var) : NULL; if (def) { @@ -4719,6 +4719,11 @@ expand_call_inline (basic_block bb, gimp } else { + if (!var) + { + tree var = create_tmp_reg_fn (cfun, TREE_TYPE (name), NULL); + SET_SSA_NAME_VAR_OR_IDENTIFIER (name, var); + } /* Otherwise make this variable undefined. */ gsi_remove (&stmt_gsi, true); set_ssa_default_def (cfun, var, name);