From patchwork Mon Jun 14 10:50:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 55518 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 E69881007D2 for ; Mon, 14 Jun 2010 20:50:32 +1000 (EST) Received: (qmail 11361 invoked by alias); 14 Jun 2010 10:50:29 -0000 Received: (qmail 11352 invoked by uid 22791); 14 Jun 2010 10:50:29 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Jun 2010 10:50:23 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 42169CB02BD; Mon, 14 Jun 2010 12:50:26 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dl9bDfS-G-GX; Mon, 14 Jun 2010 12:50:26 +0200 (CEST) Received: from saumur.act-europe.fr (saumur.act-europe.fr [10.10.0.183]) by mel.act-europe.fr (Postfix) with ESMTP id 2E5BACB021B; Mon, 14 Jun 2010 12:50:26 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 4C18AD9B31; Mon, 14 Jun 2010 12:50:33 +0200 (CEST) Date: Mon, 14 Jun 2010 12:50:33 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Ed Schonberg Subject: [Ada] Inline_Always applied to a subprogram body without previous spec Message-ID: <20100614105033.GA5126@adacore.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-IsSubscribed: yes 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 When a pragma Inline_Always is applied to a subprogram body, the compiler generates a spec to simplify subsequent inlinings of calls. The spec is created by copying the analyzed spec of the body. There is no need for a conformance spec between spec and body, and a conformance check may lead to spurious conformance errors due to constant folding of static aggregates in default expressions for formals. The following must compile quietly: procedure Inline is type R is record X, Y : Integer; end record; function Fun (It : R := (10, 20)) return Integer is begin return It.X + It.Y; end; pragma Inline_Always (Fun); begin null; end; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-14 Ed Schonberg * sem_ch6.adb (Analyze_Subprogram_Body): Do not check conformance when the spec has been generated for a body without spec that carries an Inline_Always pragma. Index: sem_ch6.adb =================================================================== --- sem_ch6.adb (revision 160720) +++ sem_ch6.adb (working copy) @@ -2086,6 +2086,15 @@ package body Sem_Ch6 is then Conformant := True; + -- Conversely, the spec may have been generated for specless body + -- with an inline pragma. + + elsif Comes_From_Source (N) + and then not Comes_From_Source (Spec_Id) + and then Has_Pragma_Inline (Spec_Id) + then + Conformant := True; + else Check_Conformance (Body_Id, Spec_Id,