]> gcc.gnu.org Git - gcc.git/commitdiff
��> 2003-06-07�� Anthony Green�� <green@redhat.com> ��>...
authorAnthony Green <green@redhat.com>
Sun, 8 Jun 2003 18:10:54 +0000 (18:10 +0000)
committerAnthony Green <green@gcc.gnu.org>
Sun, 8 Jun 2003 18:10:54 +0000 (18:10 +0000)
��> 2003-06-07�� Anthony Green�� <green@redhat.com>
��>
��>������������* parse.y (patch_cast): Fix conversions from floating-point to
��>������������integral types.

From-SVN: r67631

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

index 7253429d1279514c38c2c0e39b9a34d619949207..23bc14bbc7f80d756b3585445915f027d7d07352 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-08  Anthony Green  <green@redhat.com>
+
+       * parse.y (patch_cast): Fix conversions from floating-point to
+       integral types.
+
 2003-06-08  Neil Booth  <neil@daikokuya.co.uk>
 
        * Make-lang.in: Update.
index 62b796f6879a6ffd9f3f80c1a651fd91b9d83045..88c8c31978a54127ba646c606271b4981c8515be 100644 (file)
@@ -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);
     }
 
This page took 0.09739 seconds and 5 git commands to generate.