This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++: __java_double expressions promote to float
- From: Andrew Haley <aph at cambridge dot redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: "'java at gcc dot gnu dot org'" <java at gcc dot gnu dot org>,"Boehm, Hans" <hans_boehm at hp dot com>
- Date: Tue, 9 Apr 2002 18:51:12 +0100 (BST)
- Subject: C++: __java_double expressions promote to float
- References: <40700B4C02ABD5119F000090278766443BF19E@hplex1.hpl.hp.com>
TYPE_MAIN_VARIANT for __java_double is __java_double.
type_after_usual_arithmetic_conversions() doesn't know anything about
that type, so it converts to float. Therefore, expressions whose
operands are all of type __java_double are of type float. I think
that's wrong...
Andrew.
2002-04-09 Andrew Haley <aph@cambridge.redhat.com>
* typeck.c (type_after_usual_arithmetic_conversions):
__java_double expressions promote to __java_double, not float.
Index: typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.393
diff -c -2 -p -r1.393 typeck.c
*** typeck.c 22 Mar 2002 22:03:04 -0000 1.393
--- typeck.c 9 Apr 2002 17:46:18 -0000
*************** type_after_usual_arithmetic_conversions
*** 443,446 ****
--- 443,450 ----
return build_type_attribute_variant (double_type_node,
attributes);
+ if (same_type_p (TYPE_MAIN_VARIANT (t1), java_double_type_node)
+ || same_type_p (TYPE_MAIN_VARIANT (t2), java_double_type_node))
+ return build_type_attribute_variant (java_double_type_node,
+ attributes);
else
return build_type_attribute_variant (float_type_node,