From 44ecd94cc7daf60ed04a81107c8d52c23cfef84d Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 9 Jul 2020 05:36:18 -0400 Subject: [PATCH] [Ada] Wrong freezing for expression function with contracts in a generic gcc/ada/ * contracts.adb (Process_Preconditions_For): Do not exclude instances. * sem_ch4.adb (Analyze_Quantified_Expression): Disable spurious warning on internally generated variables. --- gcc/ada/contracts.adb | 3 +-- gcc/ada/sem_ch4.adb | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index 9d3e9e99b48..666a57ff574 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -2590,8 +2590,7 @@ package body Contracts is and then Sloc (Body_Id) /= Sloc (Subp_Id) and then In_Same_Source_Unit (Body_Id, Subp_Id) and then List_Containing (Body_Decl) /= - List_Containing (Subp_Decl) - and then not In_Instance; + List_Containing (Subp_Decl); if Present (Items) then Prag := Pre_Post_Conditions (Items); diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index c92fb0674ba..beb981d792e 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -4220,6 +4220,7 @@ package body Sem_Ch4 is if Warn_On_Suspicious_Contract and then not Referenced (Loop_Id, Cond) + and then not Is_Internal_Name (Chars (Loop_Id)) then -- Generating C, this check causes spurious warnings on inlined -- postconditions; we can safely disable it because this check -- 2.30.2