From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117227 invoked by alias); 27 Apr 2016 09:16:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 117214 invoked by uid 89); 27 Apr 2016 09:16:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=Hx-languages-length:1351, HContent-Transfer-Encoding:7Bit, visit, walked X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 27 Apr 2016 09:16:39 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id C1AEF8130A; Wed, 27 Apr 2016 11:16:36 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yuV555cvkysX; Wed, 27 Apr 2016 11:16:36 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id CFBCC812FA; Wed, 27 Apr 2016 11:16:35 +0200 (CEST) From: Eric Botcazou To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix type field walking in gimplifier unsharing Date: Wed, 27 Apr 2016 09:16:00 -0000 Message-ID: <1563866.3PAXIoXYk7@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-35-desktop; KDE/4.14.9; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-SW-Source: 2016-04/txt/msg01595.txt.bz2 > Gimplification is done in-place and thus relies on all processed > trees being unshared. This is achieved by unshare_body which > in the end uses walk_tree to get at all interesting trees that possibly > need unsharing. > > Unfortunately it doesn't really work because walk_tree only walks > types and type-related fields (TYPE_SIZE, TYPE_MIN_VALUE, etc.) in > very narrow circumstances. Right, but well defined and explained: case DECL_EXPR: /* If this is a TYPE_DECL, walk into the fields of the type that it's defining. We only want to walk into these fields of a type in this case and not in the general case of a mere reference to the type. The criterion is as follows: if the field can be an expression, it must be walked only here. This should be in keeping with the fields that are directly gimplified in gimplify_type_sizes in order for the mark/copy-if-shared/unmark machinery of the gimplifier to work with variable-sized types. Note that DECLs get walked as part of processing the BIND_EXPR. */ > Thus the following patch which makes the gimplifier unsharing > visit all types. I think this will generate a lot of useless walking in Ada... > So - any opinion on the "correct" way to fix this? Add DECL_EXPRs for the types, that's what done in Ada. -- Eric Botcazou