[Ada] Further cleanup in constraint checking code for allocators

Message ID 20200619082834.GA31460@adacore.com
State New
Headers show
Series
  • [Ada] Further cleanup in constraint checking code for allocators
Related show

Commit Message

Pierre-Marie de Rodat June 19, 2020, 8:28 a.m.
There is a second case where Expand_N_Assignment_Statement was applying
range checks for allocators and it is also obsolete.

No functional changes.

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

2020-06-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_ch5.adb (Expand_N_Assignment_Statement): Do not apply
	range checks to allocators here.

Patch

--- gcc/ada/exp_ch5.adb
+++ gcc/ada/exp_ch5.adb
@@ -2448,16 +2448,6 @@  package body Exp_Ch5 is
                Apply_Length_Check (Rhs, Etype (Lhs));
             end if;
          end if;
-
-      --  Apply range check for access type case
-
-      elsif Is_Access_Type (Etype (Lhs))
-        and then Nkind (Rhs) = N_Allocator
-        and then Nkind (Expression (Rhs)) = N_Qualified_Expression
-      then
-         Analyze_And_Resolve (Expression (Rhs));
-         Apply_Range_Check
-           (Expression (Rhs), Designated_Type (Etype (Lhs)));
       end if;
 
       --  Ada 2005 (AI-231): Generate the run-time check