From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30155 invoked by alias); 17 Sep 2019 08:06:40 -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 30070 invoked by uid 89); 17 Sep 2019 08:06:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= 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 ESMTP; Tue, 17 Sep 2019 08:06:38 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 5E8A3117BDD; Tue, 17 Sep 2019 04:06:33 -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 HaYH9yYKuJxx; Tue, 17 Sep 2019 04:06:33 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) by rock.gnat.com (Postfix) with ESMTP id 4D3F3117802; Tue, 17 Sep 2019 04:06:33 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id 4C2516AD; Tue, 17 Sep 2019 04:06:33 -0400 (EDT) Date: Tue, 17 Sep 2019 08:07:00 -0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Ed Schonberg Subject: [Ada] In a generic use Presanalyze_Spec_Expression on Predicates Message-ID: <20190917080633.GA37464@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="YZ5djTAD1cGYuMQK" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00986.txt.bz2 --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 764 When verifying that the meaning of an aspect has not changed between the freeze point of the entity and the end of the declarations, we analkyze a copy of the expression to verify its conformance to previous analysis. If the expression contains overloaded references, these have to be resolved, which is not done if the expression is only preanalyzed. This applies in particular to expressions in predicates. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-17 Ed Schonberg gcc/ada/ * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): In a generic context, for a Predicate aspect, use Preanalyze_Spec_Expression to verify conformance. gcc/testsuite/ * gnat.dg/predicate13.adb, gnat.dg/predicate13.ads: New testcase. --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" Content-length: 1107 --- gcc/ada/sem_ch13.adb +++ gcc/ada/sem_ch13.adb @@ -9383,7 +9383,7 @@ package body Sem_Ch13 is or else A_Id = Aspect_Priority then Push_Type (Ent); - Preanalyze (Freeze_Expr); + Preanalyze_Spec_Expression (Freeze_Expr, T); Pop_Type (Ent); else Preanalyze (Freeze_Expr); --- /dev/null new file mode 100644 +++ gcc/testsuite/gnat.dg/predicate13.adb @@ -0,0 +1,3 @@ +package body Predicate13 is + procedure Dummy is null; +end Predicate13; \ No newline at end of file --- /dev/null new file mode 100644 +++ gcc/testsuite/gnat.dg/predicate13.ads @@ -0,0 +1,23 @@ +-- { dg-do compile } +generic +package Predicate13 is + + function Valid return Boolean is + (True); + + function Foo return Boolean is + (True); + + type State_Type is (Valid, Invalid); + type Context_Type is private; + + private + + type Context_Type is + record + State : State_Type; + end record with Dynamic_Predicate => (State = Valid); + + procedure Dummy; + +end Predicate13; --YZ5djTAD1cGYuMQK--