From patchwork Thu Aug 4 12:02:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 108422 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]) by ozlabs.org (Postfix) with SMTP id 077EFB6F7D for ; Thu, 4 Aug 2011 22:02:48 +1000 (EST) Received: (qmail 17715 invoked by alias); 4 Aug 2011 12:02:47 -0000 Received: (qmail 17705 invoked by uid 22791); 4 Aug 2011 12:02:46 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Aug 2011 12:02:28 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 51C6B2BB2A4; Thu, 4 Aug 2011 08:02:27 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Xen1DV+Vsgz6; Thu, 4 Aug 2011 08:02:27 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 3EE862BB298; Thu, 4 Aug 2011 08:02:27 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 3CB123FEE8; Thu, 4 Aug 2011 08:02:27 -0400 (EDT) Date: Thu, 4 Aug 2011 08:02:27 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Thomas Quinot Subject: [Ada] Remote types instance in private part of RCI spec Message-ID: <20110804120227.GA25821@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 This change fixes a defect whereby instantiating a Remote_Types unit specifying user-defined stream attributes for one of its types in the private part of an RCI unit would cause undefined symbols in calling stubs. Tested on x86_64-pc-linux-gnu, committed on trunk 2011-08-04 Thomas Quinot * sem_ch12.adb (Analyze_Package_Instantiation): Do not omit body for instantiation in RCI. Index: sem_ch12.adb =================================================================== --- sem_ch12.adb (revision 177356) +++ sem_ch12.adb (working copy) @@ -3379,18 +3379,18 @@ end if; end; - -- If we are generating calling stubs, we never need a body for an - -- instantiation from source in the visible part, because in that - -- case we'll be generating stubs for any subprogram in the instance. - -- However normal processing occurs for instantiations in generated - -- code or in the private part, since in those cases we do not - -- generate stubs. + -- Note that we generate the instance body even when generating + -- calling stubs for an RCI unit: it may be required e.g. if it + -- provides stream attributes for some type used in the profile of a + -- remote subprogram. If the instantiation is within the visible part + -- of the RCI, then calling stubs for any relevant subprogram will + -- be inserted immediately after the subprogram declaration, and + -- will take precedence over the subsequent (original) body. (The + -- stub and original body will be complete homographs, but this is + -- permitted in an instance). - if Distribution_Stub_Mode = Generate_Caller_Stub_Body - and then Comes_From_Source (N) - then - Needs_Body := False; - end if; + -- Could we do better and remove the original subprogram body in that + -- case??? if Needs_Body then