From patchwork Tue Sep 5 09:49:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 810061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-461471-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="UaUA1HIT"; dkim-atps=neutral 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 3xmhlS4sQMz9s9Y for ; Tue, 5 Sep 2017 19:49:55 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=Q+Tvxy84hvnqCvkH qeyeBX+qU+bUg02qwT/9slK1iHBfgtMKN3WOJ+w1uqSsB4t7yq/AE/CdPbQ1SqsL 1geYRH3N+6qfAXqQ2RcZdd4AVi3+8bS+cMFjWYS0rLRfJq2JfrNQFzWzadvw3bDt zVIxlsYtTVI87JFfJhKHjvXpPxg= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=ia8OYkyalWw+GhAFvHnirA +Y4l8=; b=UaUA1HITm0FkWQ0VU7OKWciwbiGycWG1nd/mnpUSTWR/fEyNOAs+nO WKWC2Op81tJyIAD27V943tA5f5JOs1l7yYZydHP0Kmtij+8xDFaPR/qNpHlOfdIK NU22F1MqGx3btr046Vunnv5xxH0IHDDOjsrpBmMxawgDukPf6UG/0= Received: (qmail 109234 invoked by alias); 5 Sep 2017 09:49:48 -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 109215 invoked by uid 89); 5 Sep 2017 09:49:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= 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 ESMTP; Tue, 05 Sep 2017 09:49:42 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 3B516822E8 for ; Tue, 5 Sep 2017 11:49:40 +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 QDybl9M-EBH4 for ; Tue, 5 Sep 2017 11:49:40 +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 059AE822CE for ; Tue, 5 Sep 2017 11:49:40 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix PR ada/62235 Date: Tue, 05 Sep 2017 11:49:39 +0200 Message-ID: <6220290.NY0sf8PeYM@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-53-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Tested on x86_64-suse-linux, applied on mainline and 7 branch. 2017-09-05 Eric Botcazou PR ada/62235 * gcc-interface/decl.c (gnat_to_gnu_entity): Skip regular processing for Itypes that are E_Record_Subtype with a cloned subtype. : Use the DECL of the cloned type directly, if any. 2017-09-05 Eric Botcazou * gnat.dg/incomplete5.ad[sb]: New test. * gnat.dg/incomplete5_pkg.ad[sb]: New helper. Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 251700) +++ gcc-interface/decl.c (working copy) @@ -312,11 +312,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entit /* Since a use of an Itype is a definition, process it as such if it is in the main unit, except for E_Access_Subtype because it's actually a use - of its base type, see below. */ + of its base type, and for E_Record_Subtype with cloned subtype because + it's actually a use of the cloned subtype, see below. */ if (!definition && is_type && Is_Itype (gnat_entity) - && Ekind (gnat_entity) != E_Access_Subtype + && !(kind == E_Access_Subtype + || (kind == E_Record_Subtype + && Present (Cloned_Subtype (gnat_entity)))) && !present_gnu_tree (gnat_entity) && In_Extended_Main_Code_Unit (gnat_entity)) { @@ -3411,7 +3414,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit { gnu_decl = gnat_to_gnu_entity (Cloned_Subtype (gnat_entity), NULL_TREE, false); - maybe_present = true; + saved = true; break; }