aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2002-11-22 21:49:06 +0000
committerTom Tromey <tromey@redhat.com>2002-11-22 21:49:06 +0000
commit5e6820d2b5b2df97e73ae35e189c0954a66dd27d (patch)
treea47fac3261485517342a2cd77a5f799068289c8c /gcc/java
parent72e23676dc86237050cc75616a249ea838064f57 (diff)
* parse.y (patch_binop): Cast right hand side of shift expression
to `int'. Fixes PR java/8676. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@59390 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/parse.y5
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 0a2f1dc447b..9dd2e1e1f06 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -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>
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 2a77235f3b1..21b2235589b 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -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);