[Ada] Wrong freezing for expression function with contracts in a generic
authorArnaud Charlet <charlet@adacore.com>
Thu, 9 Jul 2020 09:36:18 +0000 (05:36 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 19 Oct 2020 09:53:39 +0000 (05:53 -0400)
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
gcc/ada/sem_ch4.adb

index 9d3e9e99b489a7c0ec2df3b452a17dc4d14733e6..666a57ff574c112aa093662aceea07f85c561de7 100644 (file)
@@ -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);
index c92fb0674ba44de7f6383391ff4ca1e75fb99a18..beb981d792e3eec73d495d55582b98cd58ca6273 100644 (file)
@@ -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