public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Fix minor issue with Mod operator
@ 2023-05-30  7:21 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-05-30  7:21 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

From: Eric Botcazou <ebotcazou@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/gcc-interface/trans.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc
index 8c8a78f5d2d..1c3c6c0618e 100644
--- a/gcc/ada/gcc-interface/trans.cc
+++ b/gcc/ada/gcc-interface/trans.cc
@@ -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
-- 
2.40.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-30  7:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30  7:21 [COMMITTED] ada: Fix minor issue with Mod operator Marc Poulhiès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).