[COMMITTED] ada: Apply range checks to preanalyzed aggregate expressions

Message ID 20230516084058.1501934-1-poulhies@adacore.com
State Accepted
Headers
Series [COMMITTED] ada: Apply range checks to preanalyzed aggregate expressions |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Marc Poulhiès May 16, 2023, 8:40 a.m. UTC
  From: Piotr Trojanek <trojanek@adacore.com>

When preanalyzing expressions in GNATprove mode, e.g. Pre/Post
contracts, we apply checks, because these expressions will never
be expanded. This didn't happen for aggregate expressions, most
likely because of an oversight.

gcc/ada/

	* sem_util.adb (Aggregate_Constraint_Checks): Don't exit early
	when preanalysing in GNATprove mode. Now the condition is
	consistent with other similar conditions in other code.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_util.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index ad74de6b6f6..38dc654f7be 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -477,7 +477,7 @@  package body Sem_Util is
       --  this breaks the name resolution mechanism for generic instances.
 
       if not Expander_Active
-        and (Inside_A_Generic or not Full_Analysis or not GNATprove_Mode)
+        and not (GNATprove_Mode and not Inside_A_Generic)
       then
          return;
       end if;