[C/C++ PATCH] Handle rotates like shifts

Jakub Jelinek jakub@redhat.com
Fri Oct 13 19:32:00 GMT 2017


Hi!

I've noticed that for {L,R}ROTATE_EXPR created during GENERIC folding
we end up with e.g. long int etc. second arguments, while for shifts
we truncate those to unsigned int.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2017-10-13  Jakub Jelinek  <jakub@redhat.com>

	* c-gimplify.c (c_gimplify_expr): Handle [LR]ROTATE_EXPR like
	[LR]SHIFT_EXPR.

--- gcc/c-family/c-gimplify.c.jj	2017-05-22 10:49:37.000000000 +0200
+++ gcc/c-family/c-gimplify.c	2017-10-13 10:20:55.844841677 +0200
@@ -229,6 +229,8 @@ c_gimplify_expr (tree *expr_p, gimple_se
     {
     case LSHIFT_EXPR:
     case RSHIFT_EXPR:
+    case LROTATE_EXPR:
+    case RROTATE_EXPR:
       {
 	/* We used to convert the right operand of a shift-expression
 	   to an integer_type_node in the FEs.  But it is unnecessary

	Jakub



More information about the Gcc-patches mailing list