re PR java/8676 (ICE in generate_bytecode_conditional at jcf-write.c:1359)
authorTom Tromey <tromey@redhat.com>
Fri, 22 Nov 2002 21:49:06 +0000 (21:49 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Fri, 22 Nov 2002 21:49:06 +0000 (21:49 +0000)
* parse.y (patch_binop): Cast right hand side of shift expression
to `int'.  Fixes PR java/8676.

From-SVN: r59390

gcc/java/ChangeLog
gcc/java/parse.y

index 0a2f1dc447bb871a1bfc8313e35d92a18a381102..9dd2e1e1f06b787e37970047b81d64ca24bbdb24 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-22  Tom Tromey  <tromey@redhat.com>
+
+       * parse.y (patch_binop): Cast right hand side of shift expression
+       to `int'.  Fixes PR java/8676.
+
 2002-11-22  Ranjit Mathew <rmathew@hotmail.com>
            Andrew Haley <aph@redhat.com>
 
index 2a77235f3b13272a2d64737c21131b8df4084fd4..21b2235589b587fb459cafd735a2256d8bf97ee1 100644 (file)
@@ -13465,6 +13465,11 @@ patch_binop (node, wfl_op1, wfl_op2)
       op1 = do_unary_numeric_promotion (op1);
       op2 = do_unary_numeric_promotion (op2);
 
+      /* If the right hand side is of type `long', first cast it to
+        `int'.  */
+      if (TREE_TYPE (op2) == long_type_node)
+       op2 = build1 (CONVERT_EXPR, int_type_node, op2);
+
       /* The type of the shift expression is the type of the promoted
          type of the left-hand operand */
       prom_type = TREE_TYPE (op1);