From f32c53c2153535de4c9016cd174330be4c9a6027 Mon Sep 17 00:00:00 2001 From: Anthony Green Date: Sun, 8 Jun 2003 18:10:54 +0000 Subject: =?UTF-8?q?=EF=BF=BD=EF=BF=BD>=202003-06-07=EF=BF=BD=EF=BF=BD=20An?= =?UTF-8?q?thony=20Green=EF=BF=BD=EF=BF=BD=20=20?= =?UTF-8?q?=EF=BF=BD=EF=BF=BD>...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ��> 2003-06-07�� Anthony Green�� ��> ��>������������* parse.y (patch_cast): Fix conversions from floating-point to ��>������������integral types. From-SVN: r67631 --- gcc/java/parse.y | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'gcc/java/parse.y') diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 62b796f..88c8c31 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -14224,14 +14224,15 @@ patch_cast (tree node, tree wfl_op) if (cast_type == op_type) return node; - /* float and double type are converted to the original type main - variant and then to the target type. */ - if (JFLOAT_TYPE_P (op_type) && TREE_CODE (cast_type) == CHAR_TYPE) - op = convert (integer_type_node, op); + /* A narrowing conversion from a floating-point number to an + integral type requires special handling (5.1.3). */ + if (JFLOAT_TYPE_P (op_type) && JINTEGRAL_TYPE_P (cast_type)) + if (cast_type != long_type_node) + op = convert (integer_type_node, op); - /* Try widening/narowwing convertion. Potentially, things need + /* Try widening/narrowing convertion. Potentially, things need to be worked out in gcc so we implement the extreme cases - correctly. fold_convert() needs to be fixed. */ + correctly. fold_convert() needs to be fixed. */ return convert (cast_type, op); } -- cgit v1.1