[COMMITTED,05/31] ada: Fix compile time evaluation needed for static unfoldings

Message ID 20250911091904.1505690-5-poulhies@adacore.com
State Committed
Commit 405aeb22ded78eec4a2a81add081291e7cab6b4c
Headers
Series [COMMITTED,01/31] ada: Disable new warning for composite equality ops that can raise Program_Error |

Commit Message

Marc Poulhiès Sept. 11, 2025, 9:18 a.m. UTC
  From: Denis Mazzucato <mazzucato@adacore.com>

Unfolding of static expressions is needed when evaluating static bounds, even in
the presence of strict analysis. Otherwise, we may wrongly identify static
predicates as dynamic ones, and thus require unnecessary "others" default case.

gcc/ada/ChangeLog:

	* sem_attr.adb (Eval_Attribute): Remove strict analysis condition.

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

---
 gcc/ada/sem_attr.adb | 7 -------
 1 file changed, 7 deletions(-)
  

Patch

diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 3a494ad940f6..2a92ffbce4f3 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -8195,13 +8195,6 @@  package body Sem_Attr is
 
       if Nkind (N) /= N_Attribute_Reference then
          return;
-
-      --  No evaluation required under strict preanalysis because locating
-      --  static expressions is not needed; this also minimizes making tree
-      --  modifications during strict preanalysis.
-
-      elsif In_Strict_Preanalysis then
-         return;
       end if;
 
       Aname := Attribute_Name (N);