This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: float->int conversion
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 24 Mar 2005 12:56:00 -0700
- Subject: [gcjx] Patch: FYI: float->int conversion
- Reply-to: tromey at redhat dot com
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