[Ada] Do not "optimize" by converting Positive to Unsigned

Message ID 20210504095223.GA90518@adacore.com
State New
Headers show
Series
  • [Ada] Do not "optimize" by converting Positive to Unsigned
Related show

Commit Message

Pierre-Marie de Rodat May 4, 2021, 9:52 a.m.
Back out the previous change that tried to "optimize" in
Expand_Concatenate. It turns out that this is actually a pessimization,
and it causes codepeer to trip over a bunch of extra checks.

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

gcc/ada/

	* exp_ch4.adb (Expand_Concatenate): Remove the non-optimization.

Patch

diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -3025,14 +3025,6 @@  package body Exp_Ch4 is
       if Is_Enumeration_Type (Ityp) then
          Artyp := Standard_Integer;
 
-      --  If index type is Positive, we use the standard unsigned type, to give
-      --  more room on the top of the range, obviating the need for an overflow
-      --  check when creating the upper bound. This is needed to avoid junk
-      --  overflow checks in the common case of String types.
-
-      elsif Istyp = Standard_Positive then
-         Artyp := Standard_Unsigned;
-
       --  For modular types, we use a 32-bit modular type for types whose size
       --  is in the range 1-31 bits. For 32-bit unsigned types, we use the
       --  identity type, and for larger unsigned types we use a 64-bit type.