This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gcjx] Patch: FYI: float->int conversion


I'm checking this in on the gcjx branch.

fold_convert() doesn't handle float->int conversion, I suppose because
it wouldn't know which conversion operator to choose.  So we use our
own convert() here instead.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* tree.cc (visit_cast): Use convert and not fold_convert.
Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.21
diff -u -r1.1.2.21 tree.cc
--- tree.cc 24 Mar 2005 02:31:33 -0000 1.1.2.21
+++ tree.cc 24 Mar 2005 15:31:15 -0000
@@ -1348,8 +1350,9 @@
 
   if (dest->type ()->primitive_p ())
     {
-      current = fold_convert (gcc_builtins->map_type (dest->type ()),
-			      expr_tree);
+      // We can't use fold_convert() here since, apparently, it can't
+      // convert a float to an int.
+      current = convert (gcc_builtins->map_type (dest->type ()), expr_tree);
       TREE_SIDE_EFFECTS (current) = TREE_SIDE_EFFECTS (expr_tree);
     }
   else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]