]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix minor issue with Mod operator
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 24 Feb 2023 15:14:30 +0000 (16:14 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 30 May 2023 07:12:18 +0000 (09:12 +0200)
gcc/ada/

* gcc-interface/trans.cc (gnat_to_gnu) <N_Op_Mod>: Test the
precision of the operation rather than that of the result type.

gcc/ada/gcc-interface/trans.cc

index 8c8a78f5d2dfc8d8f01c27d2c4e4eff984a66f79..1c3c6c0618e8e91c8d42388592c82225f491df76 100644 (file)
@@ -7095,9 +7095,9 @@ gnat_to_gnu (Node_Id gnat_node)
            gnu_rhs = convert (gnu_count_type, gnu_rhs);
            gnu_max_shift
              = convert (TREE_TYPE (gnu_rhs), TYPE_SIZE (gnu_type));
-           /* If the result type is larger than a word, then declare the dependence
-              on the libgcc routine.  */
-           if (TYPE_PRECISION (gnu_result_type) > BITS_PER_WORD)
+           /* If the result type is larger than a word, then declare the
+              dependence on the libgcc routine.  */
+           if (TYPE_PRECISION (gnu_type) > BITS_PER_WORD)
              Check_Restriction_No_Dependence_On_System (Name_Gcc, gnat_node);
          }
 
@@ -7114,7 +7114,7 @@ gnat_to_gnu (Node_Id gnat_node)
        /* If this is a modulo/remainder and the result type is larger than a
           word, then declare the dependence on the libgcc routine.  */
        else if ((kind == N_Op_Mod ||kind == N_Op_Rem)
-                && TYPE_PRECISION (gnu_result_type) > BITS_PER_WORD)
+                && TYPE_PRECISION (gnu_type) > BITS_PER_WORD)
          Check_Restriction_No_Dependence_On_System (Name_Gcc, gnat_node);
 
        /* Pending generic support for efficient vector logical operations in