[Ada] Remove obsolete code in Eval_Attribute

Message ID 20200706113855.GA135467@adacore.com
State New
Headers show
Series
  • [Ada] Remove obsolete code in Eval_Attribute
Related show

Commit Message

Pierre-Marie de Rodat July 6, 2020, 11:38 a.m.
The procedure does not deal with run-time checks at all, except in a
very peculiar case, 'Pos applied to an integer type, causing multiple
checks to be generated for this case.

No functional changes.

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

gcc/ada/

	* sem_attr.adb (Eval_Attribute): Do not apply range checks in
	the case of 'Pos applied to an integer type here.

Patch

diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -8354,16 +8354,6 @@  package body Sem_Attr is
             if not Compile_Time_Known_Value (E)
               or else not Is_Scalar_Type (Etype (E))
             then
-               --  An odd special case, if this is a Pos attribute, this
-               --  is where we need to apply a range check since it does
-               --  not get done anywhere else.
-
-               if Id = Attribute_Pos then
-                  if Is_Integer_Type (Etype (E)) then
-                     Apply_Range_Check (E, Etype (N));
-                  end if;
-               end if;
-
                Check_Expressions;
                return;