diff mbox series

[Ada] Do not generate an Itype_Reference node for slices in GNATprove mode

Message ID 20210616084356.GA96192@adacore.com
State New
Headers show
Series [Ada] Do not generate an Itype_Reference node for slices in GNATprove mode | expand

Commit Message

Pierre-Marie de Rodat June 16, 2021, 8:43 a.m. UTC
As part of the work on changing side-effects removal in SPARK, a special
case was introduced to generate an Itype_Reference for Itypes in slices.
This was based on a misunderstanding of existing checks for bounds when
analyzing slices. These Itype_Reference are actually not needed to get
the corresponding run-time checks in GNATprove, and are actually harmful
in some cases (inside quantified expressions) as the insertion point for
the Itype_Reference ends up being outside of the quantifier scope,
leading to unprovable checks.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_res.adb (Set_Slice_Subtype): Revert special-case
	introduced previously, which is not needed as Itypes created for
	slices are precisely always used.
diff mbox series

Patch

diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -12607,10 +12607,9 @@  package body Sem_Res is
       --  the point where actions for the slice are analyzed). Note that this
       --  is different from freezing the itype immediately, which might be
       --  premature (e.g. if the slice is within a transient scope). This needs
-      --  to be done only if expansion is enabled, or in GNATprove mode to
-      --  capture the associated run-time exceptions if any.
+      --  to be done only if expansion is enabled.
 
-      elsif Expander_Active or GNATprove_Mode then
+      elsif Expander_Active then
          Ensure_Defined (Typ => Slice_Subtype, N => N);
       end if;
    end Set_Slice_Subtype;