From patchwork Fri Aug 1 13:35:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 375758 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 7C2DB140119 for ; Fri, 1 Aug 2014 23:35:41 +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:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=lPlIdQQjDZB8UorAgvlSoZtOiRUyx+mu32Ynxmv81r7TBVRvjs y2N8q0brAEnJMTJ6OXwHqdPN5wTrXpAijlhDbDnAd6dNpa+fqbxxFJGbyx6LOQ4w NAZV9Eo7lUijj2dcqqdqrOHOIHvr7ZwKbXnG0OvsRY8oNiK0rfcFi0p3U= 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:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=Es6tWVSfcCNEmwz0fTwdnr+ju94=; b=hb1FLax2PoGZag3gOJ0u Uc+fCEJ1+JR7XeiTSyTMDPHLzxChADvv319WWc+GwUZuQQMjVLlPuVFUu2nK39zr y5cVu8bFsZOjQhce+Jyb8x2wHyo5y70qtiVA64l1VVPtGSxd+E/VnRc/7SZFX0Dp eLflIZ3XTpe4uCE4zm1S+Us= Received: (qmail 26807 invoked by alias); 1 Aug 2014 13:35:34 -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 26793 invoked by uid 89); 1 Aug 2014 13:35:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 01 Aug 2014 13:35:32 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id C0CD411636E; Fri, 1 Aug 2014 09:35:30 -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 sGzQlTPBc7eS; Fri, 1 Aug 2014 09:35:30 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id AF520116363; Fri, 1 Aug 2014 09:35:30 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id AE3C891976; Fri, 1 Aug 2014 09:35:30 -0400 (EDT) Date: Fri, 1 Aug 2014 09:35:30 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Ed Schonberg Subject: [Ada] Crash on entry call with preconditions and access parameters Message-ID: <20140801133530.GA12281@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) When an entry has preconditions, the entry call is wrapped in a procedure call that incorporates the precondition checks. To prevent a double expansion, with possible duplication of extra formals, that procedure call must only be pre- nalyzed and resolved. Expansion takes place upon return to the caller Resolve_Call. No short example available. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-01 Ed Schonberg * sem_res.adb (Resolve_Entry_Call): When an entry has preconditions, the entry call is wrapped in a procedure call that incorporates the precondition checks. To prevent a double expansion, with possible duplication of extra formals, that procedure call must only be pre-analyzed and resolved. Expansion takes place upon return to the caller Resolve_Call. Index: sem_res.adb =================================================================== --- sem_res.adb (revision 213460) +++ sem_res.adb (working copy) @@ -7176,7 +7176,11 @@ New_Occurrence_Of (PPC_Wrapper (Nam), Loc), Parameter_Associations => New_Actuals); Rewrite (N, New_Call); - Analyze_And_Resolve (N); + + -- Preanalyze and resolve new call. Current procedure is called + -- from Resolve_Call, after which expansion will take place. + + Preanalyze_And_Resolve (N); return; end; end if;