From patchwork Mon Aug 4 20:37:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 376440 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 CAEA114009C for ; Tue, 5 Aug 2014 06:38:05 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=CWaqZkapkXQ+kWpzcv4ewEf9tVua+IQaClph8X/EFqwYWH vJRXoBYRHuZEcnaJknLyBGDa0Y41znlS9BnLqdvKBJXLaXTTFJ5cVUJOHS/i3/vz oWcgOAXrZ2Ao+kGO7euKDim9f1L2LuTRpxBgyvFG7hElPBDPDWZhepqrqKOq0= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=SK1Gk3o2GydFFWaakW8tg4dFlbs=; b=BS67e6ovYjAeAEMI+w74 dpS9QeS2z134tyBR2qnSEqsvWVwOq40dkUkgNJY5N52VX/5bWNWaGEkqGqzZpRf+ g6Eo9ynattoognnbZHjNoMwHBXrrI5R4WRGssR6Ycbp1wM72sJN2VDxJxHsMEGE2 ZX2FFYlr2vWlrZdrwKTjxvk= Received: (qmail 10604 invoked by alias); 4 Aug 2014 20:37:58 -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 10590 invoked by uid 89); 4 Aug 2014 20:37:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, FROM_12LTRDOM autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Aug 2014 20:37:47 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1XEP0o-0006HA-TA from Bernd_Schmidt@mentor.com for gcc-patches@gcc.gnu.org; Mon, 04 Aug 2014 13:37:42 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Aug 2014 13:37:42 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.2.247.3; Mon, 4 Aug 2014 21:37:40 +0100 Message-ID: <53DFEEF4.3090305@codesourcery.com> Date: Mon, 4 Aug 2014 22:37:08 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: GCC Patches Subject: Invalid gimple for nested functions Some code I added for the ptx backend triggered tree-checking failures for gimple created in tree-nested: we can end up taking the address of an SSA_NAME, which seems invalid. The problem is that code in tree-nested wants to change the rhs of an existing assignment, but just using gimple_assign_set_rhs1 is insufficient: the previous rhs was an ADDR_EXPR, and that code remains afterwards. Fixed with the following patch, tested (including Ada) on x86_64-linux. Ok? Bernd diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 5408fba..1afcf09 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -2738,6 +2738,7 @@ finalize_nesting_tree_1 (struct nesting_info *root) gimple_stmt_iterator gsi = gsi_last (stmt_list); x = init_tmp_var (root, x, &gsi); gimple_assign_set_rhs1 (stmt, x); + gimple_assign_set_rhs_code (stmt, TREE_CODE (x)); } } }