[Ada] Simplify detection of others choice with just one value
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 8 Jun 2020 12:33:08 +0000 (14:33 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 16 Jul 2020 09:18:02 +0000 (05:18 -0400)
gcc/ada/

* sem_case.adb (Build_Choice): Simplify.

gcc/ada/sem_case.adb

index 5bb94e2..953619c 100644 (file)
@@ -1012,7 +1012,7 @@ package body Sem_Case is
          --  If there is only one choice value missing between Value1 and
          --  Value2, build an integer or enumeration literal to represent it.
 
-         if (Value2 - Value1) = 0 then
+         if Value1 = Value2 then
             if Is_Integer_Type (Choice_Type) then
                Lit_Node := Make_Integer_Literal (Loc, Value1);
                Set_Etype (Lit_Node, Choice_Type);