]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Avoid run-time conversion of 0 from Int to Uint
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 27 Sep 2024 15:53:29 +0000 (17:53 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 4 Nov 2024 15:57:55 +0000 (16:57 +0100)
Code cleanup and tiny performance improvement; semantics is unaffected.

gcc/ada/ChangeLog:

* exp_ch4.adb (Expand_N_Op_Subtract): Replace numeric literal
with universal integer constant, just like it is done in
expansion of addition operator.

gcc/ada/exp_ch4.adb

index 9024c1aebb2d659a1877717315a908292dbdc91d..b2cc672579f0e05000e8edfb74b11e8ce2037ca7 100644 (file)
@@ -10031,7 +10031,7 @@ package body Exp_Ch4 is
 
       if Is_Integer_Type (Typ)
         and then Compile_Time_Known_Value (Right_Opnd (N))
-        and then Expr_Value (Right_Opnd (N)) = 0
+        and then Expr_Value (Right_Opnd (N)) = Uint_0
       then
          Rewrite (N, Left_Opnd (N));
          return;