This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

[RFC] removal of the convert callback


I have put toghether a hack to remove the convert callback. It consists in
1) adding a lang prefix to the implementations of convert (cxx_, c_, gfc_, etc)
2) defining a convert2 function that is basically a copy of c_convert
3) converting the calls to convert to calls to the lang specif
implementations or convert2

The attached patch bootstraps, but there are some g++ regressions. I
will try to fix them and clean up the patch (a lot).

Any comment?

Thanks,
Rafael
Index: gcc/java/java-gimplify.c
===================================================================
--- gcc/java/java-gimplify.c	(revision 111978)
+++ gcc/java/java-gimplify.c	(working copy)
@@ -31,6 +31,7 @@
 #include "tree-dump.h"
 #include "tree-gimple.h"
 #include "toplev.h"
+#include "java/convert.h"
 
 static tree java_gimplify_labeled_block_expr (tree);
 static tree java_gimplify_exit_block_expr (tree);
@@ -233,7 +234,7 @@
     /* Fix up type mismatches to make legal GIMPLE.  These are
        generated in several places, in particular null pointer
        assignment and subclass assignment.  */
-    TREE_OPERAND (modify_expr, 1) = convert (lhs_type, rhs);
+    TREE_OPERAND (modify_expr, 1) = java_convert_internal (lhs_type, rhs);
 
   return modify_expr;
 }
Index: gcc/java/typeck.c
===================================================================
--- gcc/java/typeck.c	(revision 111978)
+++ gcc/java/typeck.c	(working copy)
@@ -25,7 +25,7 @@
 
 /* Written by Per Bothner <bothner@cygnus.com> */
 
-#include "config.h"
+#include "config.h" 
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
@@ -84,19 +84,19 @@
 
   result = fold_build3 (COND_EXPR, type,
 			fold_build2 (NE_EXPR, boolean_type_node, expr, expr),
-			 convert (type, integer_zero_node),
+			 java_convert_internal (type, integer_zero_node),
 			 convert_to_integer (type, expr));
   
   result = fold_build3 (COND_EXPR, type, 
 			fold_build2 (LE_EXPR, boolean_type_node, expr, 
-				     convert (TREE_TYPE (expr), 
+				     java_convert_internal (TREE_TYPE (expr), 
 					      TYPE_MIN_VALUE (type))),
 			TYPE_MIN_VALUE (type),
 			result);
   
   result = fold_build3 (COND_EXPR, type,
 			fold_build2 (GE_EXPR, boolean_type_node, expr, 
-				     convert (TREE_TYPE (expr), 
+				     java_convert_internal (TREE_TYPE (expr), 
 					      TYPE_MAX_VALUE (type))),
 			TYPE_MAX_VALUE (type),
 			result);
@@ -110,8 +110,10 @@
    conversions; callers should filter out those that are
    not permitted by the language being compiled.  */
 
+
+
 tree
-convert (tree type, tree expr)
+java_convert_internal (tree type, tree expr)
 {
   enum tree_code code = TREE_CODE (type);
 
@@ -156,7 +158,6 @@
   return error_mark_node;
 }
 
-
 /* Return a data type that has machine mode MODE.
    If the mode is an integer,
    then UNSIGNEDP selects between signed and unsigned types.  */
@@ -903,31 +904,31 @@
   if (t1 == double_type_node || t2 == double_type_node)
     {
       if (t1 != double_type_node)
-	*exp1 = convert (double_type_node, *exp1);
+	*exp1 = java_convert_internal (double_type_node, *exp1);
       if (t2 != double_type_node)
-	*exp2 = convert (double_type_node, *exp2);
+	*exp2 = java_convert_internal (double_type_node, *exp2);
       return double_type_node;
     }
   if (t1 == float_type_node || t2 == float_type_node)
     {
       if (t1 != float_type_node)
-	*exp1 = convert (float_type_node, *exp1);
+	*exp1 = java_convert_internal (float_type_node, *exp1);
       if (t2 != float_type_node)
-	*exp2 = convert (float_type_node, *exp2);
+	*exp2 = java_convert_internal (float_type_node, *exp2);
       return float_type_node;
     }
   if (t1 == long_type_node || t2 == long_type_node)
     {
       if (t1 != long_type_node)
-	*exp1 = convert (long_type_node, *exp1);
+	*exp1 = java_convert_internal (long_type_node, *exp1);
       if (t2 != long_type_node)
-	*exp2 = convert (long_type_node, *exp2);
+	*exp2 = java_convert_internal (long_type_node, *exp2);
       return long_type_node;
     }
 
   if (t1 != int_type_node)
-    *exp1 = convert (int_type_node, *exp1);
+    *exp1 = java_convert_internal (int_type_node, *exp1);
   if (t2 != int_type_node)
-    *exp2 = convert (int_type_node, *exp2);
+    *exp2 = java_convert_internal (int_type_node, *exp2);
   return int_type_node;
 }
Index: gcc/java/parse.y
===================================================================
--- gcc/java/parse.y	(revision 111978)
+++ gcc/java/parse.y	(working copy)
@@ -66,6 +66,7 @@
 #include "parse.h"
 #include "zipfile.h"
 #include "convert.h"
+#include "java/convert.h"
 #include "buffer.h"
 #include "function.h"
 #include "except.h"
@@ -11019,7 +11020,7 @@
        t = TREE_CHAIN (t), ta = TREE_CHAIN (ta))
     if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
 	TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
-      TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
+      TREE_VALUE (ta) = java_convert_internal (TREE_VALUE (t), TREE_VALUE (ta));
 
   /* Resolve unresolved returned type issues */
   t = TREE_TYPE (TREE_TYPE (method));
@@ -11874,7 +11875,7 @@
 	  return error_mark_node;
 	}
 
-      cn = fold (convert (int_type_node, cn));
+      cn = fold (java_convert_internal (int_type_node, cn));
       TREE_CONSTANT_OVERFLOW (cn) = 0;
       CAN_COMPLETE_NORMALLY (cn) = 1;
 
@@ -12083,7 +12084,7 @@
       for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
 	{
 	  int location = EXPR_WFL_LINECOL (TREE_VALUE (cn));
-	  tree dim = convert (int_type_node,
+	  tree dim = java_convert_internal (int_type_node,
 			      java_complete_tree (TREE_VALUE (cn)));
 	  if (dim == error_mark_node)
 	    {
@@ -12907,7 +12908,7 @@
   /* 15.25.2 If we have a compound assignment, convert RHS into the
      type of the LHS */
   else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
-    new_rhs = convert (lhs_type, rhs);
+    new_rhs = java_convert_internal (lhs_type, rhs);
 
   /* Explicit cast required. This is an error */
   if (!new_rhs)
@@ -12957,7 +12958,7 @@
   /* If we're processing a `return' statement, promote the actual type
      to the promoted type.  */
   if (is_return)
-    new_rhs = convert (TREE_TYPE (lvalue), new_rhs);
+    new_rhs = java_convert_internal (TREE_TYPE (lvalue), new_rhs);
 
   /* 10.10: Array Store Exception runtime check */
   if (!flag_emit_class_files
@@ -13098,7 +13099,7 @@
   /* 5.1.1 Try Identity Conversion,
      5.1.2 Try Widening Primitive Conversion */
   else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type))
-    new_rhs = convert (lhs_type, rhs);
+    new_rhs = java_convert_internal (lhs_type, rhs);
 
   /* Try a narrowing primitive conversion (5.1.3):
        - expression is a constant expression of type byte, short, char,
@@ -13113,7 +13114,7 @@
 	       || lhs_type == short_type_node))
     {
       if (int_fits_type_p (rhs, lhs_type))
-        new_rhs = convert (lhs_type, rhs);
+        new_rhs = java_convert_internal (lhs_type, rhs);
       else if (wfl_op1)		/* Might be called with a NULL */
 	parse_warning_context
 	  (wfl_op1,
@@ -13332,7 +13333,7 @@
 {
   tree type = TREE_TYPE (arg);
   if (TREE_CODE (type) == INTEGER_TYPE && TYPE_PRECISION (type) < 32)
-    arg = convert (int_type_node, arg);
+    arg = java_convert_internal (int_type_node, arg);
   return arg;
 }
 
@@ -13679,10 +13680,10 @@
 	{
 	  tree to_return;
           tree utype = java_unsigned_type (prom_type);
-          op1 = convert (utype, op1);
+          op1 = java_convert_internal (utype, op1);
 
 	  to_return = fold_build2 (RSHIFT_EXPR, utype, op1, op2);
-	  to_return = convert (prom_type, to_return);
+	  to_return = java_convert_internal (prom_type, to_return);
 	  /* Copy the original value of the COMPOUND_ASSIGN_P flag */
 	  COMPOUND_ASSIGN_P (to_return) = COMPOUND_ASSIGN_P (node);
 	  TREE_SIDE_EFFECTS (to_return)
@@ -14141,7 +14142,7 @@
 
   /* ??? Guessing that the class file code can't handle casts.  */
   if (! flag_emit_class_files)
-    node = convert (string_ptr_type_node, node);
+    node = java_convert_internal (string_ptr_type_node, node);
   else
     TREE_TYPE (node) = string_ptr_type_node;
 
@@ -14392,7 +14393,7 @@
 	  if (JINTEGRAL_TYPE_P (op_type))
 	    return fold (node);
 	  else
-	    return fold (convert (op_type, node));
+	    return fold (java_convert_internal (op_type, node));
 	}
       break;
 
@@ -14538,12 +14539,12 @@
 	 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);
+	  op = java_convert_internal (integer_type_node, op);
 
       /* Try widening/narrowing conversion.  Potentially, things need
 	 to be worked out in gcc so we implement the extreme cases
 	 correctly.  fold_convert() needs to be fixed.  */
-      return convert (cast_type, op);
+      return java_convert_internal (cast_type, op);
     }
 
   /* It's also valid to cast a boolean into a boolean */
Index: gcc/java/class.c
===================================================================
--- gcc/java/class.c	(revision 111978)
+++ gcc/java/class.c	(working copy)
@@ -46,6 +46,7 @@
 #include "cgraph.h"
 #include "tree-iterator.h"
 #include "cgraph.h"
+#include "java/convert.h"
 
 /* DOS brain-damage */
 #ifndef O_BINARY
@@ -940,7 +941,7 @@
   tree cl;
   index = alloc_class_constant (type);
   cl = build_ref_from_constant_pool (index); 
-  return convert (promote_type (class_ptr_type), cl);
+  return java_convert_internal (promote_type (class_ptr_type), cl);
 }
 
 /* Build a reference to the class TYPE.
@@ -1503,7 +1504,7 @@
   if (method_index != NULL_TREE)
     {
       /* method_index is null if we're using indirect dispatch.  */
-      method_index = fold (convert (sizetype, method_index));
+      method_index = fold (java_convert_internal (sizetype, method_index));
 
       if (TARGET_VTABLE_USES_DESCRIPTORS)
 	/* Add one to skip bogus descriptor for class and GC descriptor. */
@@ -1869,8 +1870,8 @@
   PUSH_FIELD_VALUE (cons, "interface_count",
 		    build_int_cst (NULL_TREE, interface_len));
   PUSH_FIELD_VALUE (cons, "state",
-		    convert (byte_type_node,
-			     build_int_cst (NULL_TREE, JV_STATE_PRELOADING)));
+		    java_convert_internal (byte_type_node,
+					   build_int_cst (NULL_TREE, JV_STATE_PRELOADING)));
 
   PUSH_FIELD_VALUE (cons, "thread", null_pointer_node);
   PUSH_FIELD_VALUE (cons, "depth", integer_zero_node);
@@ -2197,7 +2198,7 @@
 
   /* Convert the size back to an SI integer value.  */
   TYPE_SIZE_UNIT (this_class) =
-    fold (convert (int_type_node, TYPE_SIZE_UNIT (this_class)));
+    fold (java_convert_internal (int_type_node, TYPE_SIZE_UNIT (this_class)));
 
   CLASS_BEING_LAIDOUT (this_class) = 0;
   class_list = TREE_CHAIN (class_list);
Index: gcc/java/Make-lang.in
===================================================================
--- gcc/java/Make-lang.in	(revision 111978)
+++ gcc/java/Make-lang.in	(working copy)
@@ -331,7 +331,7 @@
   coretypes.h $(TM_H) intl.h
 java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \
   toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(EXPR_H) diagnostic.h \
-  langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h opts.h options.h
+  langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h opts.h options.h java/convert.h
 java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \
   coretypes.h $(TM_H) toplev.h $(GGC_H) gt-java-mangle.h $(LANGHOOKS_DEF_H)
 java/mangle_name.o: java/mangle_name.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) \
Index: gcc/java/except.c
===================================================================
--- gcc/java/except.c	(revision 111978)
+++ gcc/java/except.c	(working copy)
@@ -38,6 +38,7 @@
 #include "except.h"
 #include "java-except.h"
 #include "toplev.h"
+#include "java/convert.h"
 
 static void expand_start_java_handler (struct eh_range *);
 static struct eh_range *find_handler_in_range (int, struct eh_range *,
@@ -425,7 +426,7 @@
 		   TYPE_CATCH_CLASSES (output_class));
     }
 
-  exp = convert (ptr_type_node, exp);
+  exp = java_convert_internal (ptr_type_node, exp);
 
   *slot = tree_cons (type, exp, NULL_TREE);
 
Index: gcc/java/jcf-write.c
===================================================================
--- gcc/java/jcf-write.c	(revision 111978)
+++ gcc/java/jcf-write.c	(working copy)
@@ -39,6 +39,7 @@
 #include "toplev.h"
 #include "ggc.h"
 #include "tm_p.h"
+#include "java/convert.h"
 
 extern struct obstack temporary_obstack;
 
@@ -2166,7 +2167,7 @@
 	  if (arg0 != NULL_TREE)
 	    generate_bytecode_insns (arg0, target, state);
 	  if (jopcode >= OPCODE_lshl && jopcode <= OPCODE_lushr)
-	    arg1 = convert (int_type_node, arg1);
+	    arg1 = java_convert_internal (int_type_node, arg1);
 	  generate_bytecode_insns (arg1, target, state);
 	}
       /* For most binary operations, both operands and the result have the
Index: gcc/java/expr.c
===================================================================
--- gcc/java/expr.c	(revision 111978)
+++ gcc/java/expr.c	(working copy)
@@ -45,6 +45,7 @@
 #include "ggc.h"
 #include "tree-gimple.h"
 #include "target.h"
+#include "java/convert.h"
 
 static void flush_quick_stack (void);
 static void push_value (tree);
@@ -284,7 +285,7 @@
   if (TYPE_PRECISION (type) < 32 && INTEGRAL_TYPE_P (type))
     {
       type = promote_type (type);
-      value = convert (type, value);
+      value = java_convert_internal (type, value);
     }
   push_type (type);
   if (tree_list_free_list == NULL_TREE)
@@ -858,7 +859,7 @@
 {
   tree t;
   t = java_check_reference (expr, check);
-  t = convert (build_pointer_type (type), t);
+  t = java_convert_internal (build_pointer_type (type), t);
   return build1 (INDIRECT_REF, type, t);
 }
 
@@ -890,10 +891,10 @@
        * Note this is equivalent to and more efficient than:
        * INDEX < 0 || INDEX >= LEN && throw ... */
       tree test;
-      tree len = convert (unsigned_int_type_node,
+      tree len = java_convert_internal (unsigned_int_type_node,
 			  build_java_array_length_access (array));
       test = fold_build2 (GE_EXPR, boolean_type_node, 
-			  convert (unsigned_int_type_node, index),
+			  java_convert_internal (unsigned_int_type_node, index),
 			  len);
       if (! integer_zerop (test))
 	{
@@ -1275,7 +1276,7 @@
   copy = build_decl (VAR_DECL, NULL_TREE, type);
   if ((INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type))
       && TREE_TYPE (copy) != TREE_TYPE (var))
-    var = convert (type, var);
+    var = java_convert_internal (type, var);
   java_add_local_var (copy);
   java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (var), copy, var));
   
@@ -1455,8 +1456,8 @@
 build_java_soft_divmod (enum tree_code op, tree type, tree op1, tree op2)
 {
   tree call = NULL;
-  tree arg1 = convert (type, op1);
-  tree arg2 = convert (type, op2);
+  tree arg1 = java_convert_internal (type, op1);
+  tree arg2 = java_convert_internal (type, op2);
 
   if (type == int_type_node)
     {	  
@@ -1506,9 +1507,9 @@
     case URSHIFT_EXPR:
       {
 	tree u_type = java_unsigned_type (type);
-	arg1 = convert (u_type, arg1);
+	arg1 = java_convert_internal (u_type, arg1);
 	arg1 = build_java_binop (RSHIFT_EXPR, u_type, arg1, arg2);
-	return convert (type, arg1);
+	return java_convert_internal (type, arg1);
       }
     case LSHIFT_EXPR:
     case RSHIFT_EXPR:
@@ -1553,8 +1554,8 @@
 	  tree call;
 	  if (type != double_type_node)
 	    {
-	      arg1 = convert (double_type_node, arg1);
-	      arg2 = convert (double_type_node, arg2);
+	      arg1 = java_convert_internal (double_type_node, arg1);
+	      arg2 = java_convert_internal (double_type_node, arg2);
 	    }
 	  call = build3 (CALL_EXPR, double_type_node,
 			 build_address_of (soft_fmod_node),
@@ -1562,7 +1563,7 @@
 				    build_tree_list (NULL_TREE, arg2)),
 			 NULL_TREE);
 	  if (type != double_type_node)
-	    call = convert (type, call);
+	    call = java_convert_internal (type, call);
 	  return call;
 	}
       
@@ -1707,7 +1708,7 @@
 				NULL_TREE),
 			field_offset);
 	  
-	  field_offset = fold (convert (sizetype, field_offset));
+	  field_offset = fold (java_convert_internal (sizetype, field_offset));
 	  address 
 	    = fold_build2 (PLUS_EXPR, 
 			   build_pointer_type (TREE_TYPE (field_decl)),
@@ -1880,7 +1881,7 @@
       else if (targetm.calls.promote_prototypes (type)
 	       && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
 	       && INTEGRAL_TYPE_P (type))
-	arg = convert (integer_type_node, arg);
+	arg = java_convert_internal (integer_type_node, arg);
       return tree_cons (NULL_TREE, arg, tail);
     }
   gcc_unreachable ();
@@ -2026,7 +2027,7 @@
 		      TYPE_ATABLE_DECL (output_class), table_index,
 		      NULL_TREE, NULL_TREE);
 	}
-      func = convert (method_ptr_type_node, func);
+      func = java_convert_internal (method_ptr_type_node, func);
     }
   else
     {
@@ -2168,7 +2169,7 @@
     }
 
   func = fold_build2 (PLUS_EXPR, nativecode_ptr_ptr_type_node, dtable,
-		      convert (nativecode_ptr_ptr_type_node, method_index));
+		      java_convert_internal (nativecode_ptr_ptr_type_node, method_index));
 
   if (TARGET_VTABLE_USES_DESCRIPTORS)
     func = build1 (NOP_EXPR, nativecode_ptr_type_node, func);
@@ -2217,8 +2218,8 @@
 		 TYPE_ITABLE_DECL (output_class), 
 		  build_int_cst (NULL_TREE, itable_index),
 		  NULL_TREE, NULL_TREE);
-      interface = convert (class_ptr_type, interface);
-      idx = convert (integer_type_node, idx);
+      interface = java_convert_internal (class_ptr_type, interface);
+      idx = java_convert_internal (integer_type_node, idx);
     }
   else
     {
@@ -2363,7 +2364,7 @@
       if (opcode != OPCODE_invokestatic) 
 	pop_type (self_type);
       method_type = promote_type (TREE_TYPE (method_type));
-      push_value (convert (method_type, integer_zero_node));
+      push_value (java_convert_internal (method_type, integer_zero_node));
       return;
     }
 
@@ -2686,7 +2687,7 @@
   if (is_error)
     {
       if (! is_putting)
-	push_value (convert (field_type, integer_zero_node));
+	push_value (java_convert_internal (field_type, integer_zero_node));
       flush_quick_stack ();
       return;
     }
@@ -3010,7 +3011,7 @@
       name = get_name_constant (jcf, JPOOL_USHORT1 (jcf, index));
       index = alloc_name_constant (CONSTANT_String, name);
       c = build_ref_from_constant_pool (index);
-      c = convert (promote_type (string_type_node), c);
+      c = java_convert_internal (promote_type (string_type_node), c);
     }
   else
     c = get_constant (jcf, index);
@@ -3208,13 +3209,13 @@
 #define CONVERT2(FROM_TYPE, TO_TYPE)					 \
   {									 \
     push_value (build1 (NOP_EXPR, int_type_node,			 \
-			(convert (TO_TYPE##_type_node,			 \
+			(java_convert_internal (TO_TYPE##_type_node,			 \
 				  pop_value (FROM_TYPE##_type_node))))); \
   }
 
 #define CONVERT(FROM_TYPE, TO_TYPE)				\
   {								\
-    push_value (convert (TO_TYPE##_type_node,	                \
+    push_value (java_convert_internal (TO_TYPE##_type_node,	                \
 			 pop_value (FROM_TYPE##_type_node)));	\
   }
 
Index: gcc/java/lang.c
===================================================================
--- gcc/java/lang.c	(revision 111978)
+++ gcc/java/lang.c	(working copy)
@@ -46,6 +46,7 @@
 #include "tree-dump.h"
 #include "opts.h"
 #include "options.h"
+#include "convert.h"
 
 static bool java_init (void);
 static void java_finish (void);
@@ -213,6 +214,7 @@
 #undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
 #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME java_mangle_decl
 
+
 /* Each front end provides its own.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
Index: gcc/java/convert.h
===================================================================
--- gcc/java/convert.h	(revision 111978)
+++ gcc/java/convert.h	(working copy)
@@ -23,3 +23,5 @@
 extern tree convert_to_integer (tree type, tree expr);
 extern tree convert_to_real (tree type, tree expr);
 extern tree convert_to_pointer (tree type, tree expr);
+extern tree java_convert (tree type, tree expr);
+extern tree java_convert_internal (tree type, tree expr);
Index: gcc/c-lex.c
===================================================================
--- gcc/c-lex.c	(revision 111978)
+++ gcc/c-lex.c	(working copy)
@@ -689,7 +689,7 @@
   /* Create a node with determined type and value.  */
   value = build_real (type, real);
   if (flags & CPP_N_IMAGINARY)
-    value = build_complex (NULL_TREE, convert (type, integer_zero_node), value);
+    value = build_complex (NULL_TREE, convert2 (type, integer_zero_node), value);
 
   return value;
 }
Index: gcc/tree.c
===================================================================
--- gcc/tree.c	(revision 111978)
+++ gcc/tree.c	(working copy)
@@ -5021,8 +5021,8 @@
   if (type == NULL_TREE)
     type = sizetype;
 
-  TYPE_MIN_VALUE (itype) = convert (type, lowval);
-  TYPE_MAX_VALUE (itype) = highval ? convert (type, highval) : NULL;
+  TYPE_MIN_VALUE (itype) = convert2 (type, lowval);
+  TYPE_MAX_VALUE (itype) = highval ? convert2 (type, highval) : NULL;
 
   TYPE_PRECISION (itype) = TYPE_PRECISION (type);
   TYPE_MODE (itype) = TYPE_MODE (type);
Index: gcc/tree.h
===================================================================
--- gcc/tree.h	(revision 111978)
+++ gcc/tree.h	(working copy)
@@ -3799,7 +3799,7 @@
 
 extern tree non_lvalue (tree);
 
-extern tree convert (tree, tree);
+extern tree convert2 (tree, tree);
 extern unsigned int expr_align (tree);
 extern tree expr_first (tree);
 extern tree expr_last (tree);
Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c	(revision 111978)
+++ gcc/builtins.c	(working copy)
@@ -4287,7 +4287,7 @@
 static tree
 dummy_object (tree type)
 {
-  tree t = convert (build_pointer_type (type), null_pointer_node);
+  tree t = convert2 (build_pointer_type (type), null_pointer_node);
   return build1 (INDIRECT_REF, type, t);
 }
 
@@ -9647,7 +9647,7 @@
 
   if (call && retval)
     {
-      retval = convert
+      retval = convert2
 	(TREE_TYPE (TREE_TYPE (implicit_built_in_decls[BUILT_IN_SPRINTF])),
 	 retval);
       return build2 (COMPOUND_EXPR, TREE_TYPE (retval), call, retval);
Index: gcc/objc/objc-act.c
===================================================================
--- gcc/objc/objc-act.c	(revision 111978)
+++ gcc/objc/objc-act.c	(working copy)
@@ -825,14 +825,14 @@
 			 size_binop (PLUS_EXPR,
 				     size_binop
 				     (MULT_EXPR,
-				      convert (bitsizetype,
+				     convert2 (bitsizetype,
 					       DECL_FIELD_OFFSET (field)),
 				      bitsize_int (BITS_PER_UNIT)),
 				     DECL_FIELD_BIT_OFFSET (field)),
 			 DECL_SIZE (field))
 	   : bitsize_zero_node);
       DECL_SIZE_UNIT (base)
-	= size_binop (FLOOR_DIV_EXPR, convert (sizetype, DECL_SIZE (base)),
+	= size_binop (FLOOR_DIV_EXPR,convert2 (sizetype, DECL_SIZE (base)),
 		      size_int (BITS_PER_UNIT));
       DECL_ARTIFICIAL (base) = 1;
       DECL_ALIGN (base) = 1;
@@ -1966,7 +1966,7 @@
       desc->constructor = constructor;
     }
 
-  addr = convert (build_pointer_type (constant_string_type),
+  addr =convert2 (build_pointer_type (constant_string_type),
 		  build_unary_op (ADDR_EXPR, desc->constructor, 1));
 
   return addr;
@@ -2155,7 +2155,7 @@
   else
     initlist
       = tree_cons (NULL_TREE,
-		   convert (build_pointer_type (objc_selector_type),
+		  convert2 (build_pointer_type (objc_selector_type),
 			    build_unary_op (ADDR_EXPR,
 					    UOBJC_SELECTOR_TABLE_decl, 1)),
 		   initlist);
@@ -2250,7 +2250,7 @@
 
   /* size = { ..., sizeof (struct _objc_module), ... } */
 
-  expr = convert (long_integer_type_node,
+  expr =convert2 (long_integer_type_node,
 		  size_in_bytes (objc_module_template));
   initlist = tree_cons (NULL_TREE, expr, initlist);
 
@@ -2501,7 +2501,7 @@
 static tree
 build_selector (tree ident)
 {
-  return convert (objc_selector_type,
+  return convert2 (objc_selector_type,
 		  add_objc_string (ident, meth_var_names));
 }
 
@@ -2633,7 +2633,7 @@
 			 build_array_ref (UOBJC_SELECTOR_TABLE_decl,
 					  build_int_cst (NULL_TREE, index)),
 			 1);
-  return convert (objc_selector_type, expr);
+  return convert2 (objc_selector_type, expr);
 }
 
 static tree
@@ -2798,7 +2798,7 @@
   while (*chain)
     {
       if (TREE_VALUE (*chain) == ident)
-	return convert (string_type_node,
+	return convert2 (string_type_node,
 			build_unary_op (ADDR_EXPR, TREE_PURPOSE (*chain), 1));
 
       chain = &TREE_CHAIN (*chain);
@@ -2818,7 +2818,7 @@
 
   *chain = tree_cons (decl, ident, NULL_TREE);
 
-  return convert (string_type_node, build_unary_op (ADDR_EXPR, decl, 1));
+  return convert2 (string_type_node, build_unary_op (ADDR_EXPR, decl, 1));
 }
 
 static GTY(()) int class_names_idx;
@@ -3067,17 +3067,17 @@
   */
   tree offs
     = objc_substitute_decl
-      (lhs, outervar, convert (TREE_TYPE (outervar), integer_zero_node));
+      (lhs, outervar,convert2 (TREE_TYPE (outervar), integer_zero_node));
   tree func
     = (flag_objc_direct_dispatch
        ? objc_assign_ivar_fast_decl
        : objc_assign_ivar_decl);
 
-  offs = convert (integer_type_node, build_unary_op (ADDR_EXPR, offs, 0));
+  offs =convert2 (integer_type_node, build_unary_op (ADDR_EXPR, offs, 0));
   offs = fold (offs);
   func_params = tree_cons (NULL_TREE, 
-	convert (objc_object_type, rhs),
-	    tree_cons (NULL_TREE, convert (objc_object_type, outervar),
+	convert2 (objc_object_type, rhs),
+	    tree_cons (NULL_TREE,convert2 (objc_object_type, outervar),
 		tree_cons (NULL_TREE, offs,
 		    NULL_TREE)));
 
@@ -3089,8 +3089,8 @@
 objc_build_global_assignment (tree lhs, tree rhs)
 {
   tree func_params = tree_cons (NULL_TREE,
-	convert (objc_object_type, rhs),
-	    tree_cons (NULL_TREE, convert (build_pointer_type (objc_object_type),
+	convert2 (objc_object_type, rhs),
+	    tree_cons (NULL_TREE,convert2 (build_pointer_type (objc_object_type),
 		      build_unary_op (ADDR_EXPR, lhs, 0)),
 		    NULL_TREE));
 
@@ -3102,8 +3102,8 @@
 objc_build_strong_cast_assignment (tree lhs, tree rhs)
 {
   tree func_params = tree_cons (NULL_TREE,
-	convert (objc_object_type, rhs),
-	    tree_cons (NULL_TREE, convert (build_pointer_type (objc_object_type),
+	convert2 (objc_object_type, rhs),
+	    tree_cons (NULL_TREE,convert2 (build_pointer_type (objc_object_type),
 		      build_unary_op (ADDR_EXPR, lhs, 0)), 
 		    NULL_TREE));
 
@@ -3525,11 +3525,11 @@
 #ifdef OBJCPLUS
   /* Convert _setjmp argument to type that is expected.  */
   if (TYPE_ARG_TYPES (TREE_TYPE (objc_setjmp_decl)))
-    t = convert (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (objc_setjmp_decl))), t);
+    t =convert2 (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (objc_setjmp_decl))), t);
   else
-    t = convert (ptr_type_node, t);
+    t =convert2 (ptr_type_node, t);
 #else
-  t = convert (ptr_type_node, t);
+  t =convert2 (ptr_type_node, t);
 #endif
   t = tree_cons (NULL, t, NULL);
   sj = build_function_call (objc_setjmp_decl, t);
@@ -3552,7 +3552,7 @@
   t = build_fold_addr_expr (cur_try_context->stack_decl);
   t = tree_cons (NULL, t, NULL);
   t = build_function_call (objc_exception_extract_decl, t);
-  t = convert (TREE_TYPE (decl), t);
+  t =convert2 (TREE_TYPE (decl), t);
   t = build2 (MODIFY_EXPR, void_type_node, decl, t);
 
   return t;
@@ -3686,7 +3686,7 @@
 
   /* Initialize rethrow_decl.  */
   t = build2 (MODIFY_EXPR, void_type_node, rethrow_decl,
-	      convert (objc_object_type, null_pointer_node));
+	     convert2 (objc_object_type, null_pointer_node));
   SET_EXPR_LOCATION (t, cur_try_context->try_locus);
   append_to_statement_list (t, &BIND_EXPR_BODY (bind));
 
@@ -3824,7 +3824,7 @@
 
   /* Initialize the decl from the EXC_PTR_EXPR we get from the runtime.  */
   t = objc_build_exc_ptr ();
-  t = convert (TREE_TYPE (decl), t);
+  t =convert2 (TREE_TYPE (decl), t);
   t = build2 (MODIFY_EXPR, void_type_node, decl, t);
   add_stmt (t);
 }
@@ -4663,7 +4663,7 @@
       protocol_name_expr = add_objc_string (PROTOCOL_NAME (p), class_names);
 
       if (refs_decl)
-	refs_expr = convert (build_pointer_type (build_pointer_type
+	refs_expr =convert2 (build_pointer_type (build_pointer_type
 						 (objc_protocol_template)),
 			     build_unary_op (ADDR_EXPR, refs_decl, 0));
       else
@@ -4701,7 +4701,7 @@
     initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
   else
     {
-      expr = convert (objc_method_proto_list_ptr,
+      expr =convert2 (objc_method_proto_list_ptr,
 		      build_unary_op (ADDR_EXPR, instance_methods, 0));
       initlist = tree_cons (NULL_TREE, expr, initlist);
     }
@@ -4710,7 +4710,7 @@
     initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
   else
     {
-      expr = convert (objc_method_proto_list_ptr,
+      expr =convert2 (objc_method_proto_list_ptr,
 		      build_unary_op (ADDR_EXPR, class_methods, 0));
       initlist = tree_cons (NULL_TREE, expr, initlist);
     }
@@ -5278,7 +5278,7 @@
 
       elemlist
 	= tree_cons (NULL_TREE,
-		     convert (ptr_type_node, 
+		    convert2 (ptr_type_node, 
 			      build_unary_op (ADDR_EXPR,
 					      METHOD_DEFINITION (entries), 1)),
 		     elemlist);
@@ -5505,7 +5505,7 @@
     initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
   else
     {
-      expr = convert (objc_method_list_ptr,
+      expr =convert2 (objc_method_list_ptr,
 		      build_unary_op (ADDR_EXPR, instance_methods, 0));
       initlist = tree_cons (NULL_TREE, expr, initlist);
     }
@@ -5513,7 +5513,7 @@
     initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
   else
     {
-      expr = convert (objc_method_list_ptr,
+      expr =convert2 (objc_method_list_ptr,
 		      build_unary_op (ADDR_EXPR, class_methods, 0));
       initlist = tree_cons (NULL_TREE, expr, initlist);
     }
@@ -5523,7 +5523,7 @@
      initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
   else
     {
-      expr = convert (build_pointer_type
+      expr =convert2 (build_pointer_type
 		      (build_pointer_type 
 		       (objc_protocol_template)),
 		      build_unary_op (ADDR_EXPR, protocol_list, 0));
@@ -5582,7 +5582,7 @@
 			initlist);
 
   /* instance_size = */
-  initlist = tree_cons (NULL_TREE, convert (long_integer_type_node, size),
+  initlist = tree_cons (NULL_TREE,convert2 (long_integer_type_node, size),
 			initlist);
 
   /* objc_ivar_list = */
@@ -5590,7 +5590,7 @@
     initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
   else
     {
-      expr = convert (objc_ivar_list_ptr,
+      expr =convert2 (objc_ivar_list_ptr,
 		      build_unary_op (ADDR_EXPR, ivar_list, 0));
       initlist = tree_cons (NULL_TREE, expr, initlist);
     }
@@ -5600,7 +5600,7 @@
     initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
   else
     {
-      expr = convert (objc_method_list_ptr,
+      expr =convert2 (objc_method_list_ptr,
 		      build_unary_op (ADDR_EXPR, dispatch_table, 0));
       initlist = tree_cons (NULL_TREE, expr, initlist);
     }
@@ -5625,7 +5625,7 @@
     initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
   else
     {
-      expr = convert (build_pointer_type
+      expr =convert2 (build_pointer_type
 		      (build_pointer_type 
 		       (objc_protocol_template)),
 		      build_unary_op (ADDR_EXPR, protocol_list, 0));
@@ -5765,7 +5765,7 @@
     = build_shared_structure_initializer
       (TREE_TYPE (decl),
        root_expr, super_expr, name_expr,
-       convert (integer_type_node, TYPE_SIZE_UNIT (objc_class_template)),
+      convert2 (integer_type_node, TYPE_SIZE_UNIT (objc_class_template)),
        2 /*CLS_META*/,
        UOBJC_CLASS_METHODS_decl,
        UOBJC_CLASS_VARIABLES_decl,
@@ -5784,7 +5784,7 @@
       (TREE_TYPE (decl),
        build_unary_op (ADDR_EXPR, UOBJC_METACLASS_decl, 0),
        super_expr, name_expr,
-       convert (integer_type_node,
+      convert2 (integer_type_node,
 		TYPE_SIZE_UNIT (CLASS_STATIC_TEMPLATE
 				(implementation_template))),
        1 /*CLS_FACTORY*/ | cls_flags,
@@ -6581,7 +6581,7 @@
 
   /* ??? Ideally we'd build the reference with objc_protocol_type directly,
      if we have it, rather than converting it here.  */
-  expr = convert (objc_protocol_type, expr);
+  expr =convert2 (objc_protocol_type, expr);
 
   /* The @protocol() expression is being compiled into a pointer to a
      statically allocated instance of the Protocol class.  To become
@@ -6712,7 +6712,7 @@
 	 paradigm.  */
       warning (0, "instance variable %qs accessed in class method",
 	       IDENTIFIER_POINTER (id));
-      self_decl = convert (objc_instance_type, self_decl); /* cast */
+      self_decl =convert2 (objc_instance_type, self_decl); /* cast */
     }
 
   return objc_build_component_ref (build_indirect_ref (self_decl, "->"), id);
@@ -9242,7 +9242,7 @@
   type = TREE_TYPE (decl);
 
   expr = add_objc_string (TREE_VALUE (chain), class_names);
-  expr = convert (type, expr); /* cast! */
+  expr =convert2 (type, expr); /* cast! */
 
   /* The decl that is the one that we
      forward declared in build_class_reference.  */
Index: gcc/cp/typeck.c
===================================================================
--- gcc/cp/typeck.c	(revision 111978)
+++ gcc/cp/typeck.c	(working copy)
@@ -2443,7 +2443,7 @@
 		 allowed with -Wno-pmf-conversions. It only works for
 		 pmf constants.  */
 	      e1 = build_addr_func (PTRMEM_CST_MEMBER (function));
-	      e1 = convert (fntype, e1);
+	      e1 = cxx_convert_internal (fntype, e1);
 	      return e1;
 	    }
 	  else
@@ -5527,7 +5527,7 @@
 	{
 	  if (! same_type_p (TREE_TYPE (rhs), lhstype))
 	    /* Call convert to generate an error; see PR 11063.  */
-	    rhs = convert (lhstype, rhs);
+	    rhs = cxx_convert_internal (lhstype, rhs);
 	  result = build2 (INIT_EXPR, lhstype, lhs, rhs);
 	  TREE_SIDE_EFFECTS (result) = 1;
 	  return result;
@@ -5974,7 +5974,7 @@
 				 /*c_cast_p=*/0);
 
   if (!DECL_VIRTUAL_P (fn))
-    *pfn = convert (TYPE_PTRMEMFUNC_FN_TYPE (type), build_addr_func (fn));
+    *pfn = cxx_convert_internal (TYPE_PTRMEMFUNC_FN_TYPE (type), build_addr_func (fn));
   else
     {
       /* If we're dealing with a virtual function, we have to adjust 'this'
@@ -6061,7 +6061,7 @@
 
   if (TREE_CODE (type) == VECTOR_TYPE && coder == VECTOR_TYPE
       && vector_types_convertible_p (type, rhstype))
-    return convert (type, rhs);
+    return cxx_convert_internal (type, rhs);
 
   if (rhs == error_mark_node || rhstype == error_mark_node)
     return error_mark_node;
@@ -6102,7 +6102,7 @@
 	}
 
       if (objc_compare_types (type, rhstype, parmno, rname))
-	return convert (type, rhs);
+	return cxx_convert_internal (type, rhs);
     }
 
   /* [expr.ass]
@@ -6503,7 +6503,7 @@
       retval = convert_for_initialization
 	(NULL_TREE, functype, retval, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
 	 "return", NULL_TREE, 0);
-      retval = convert (valtype, retval);
+      retval = cxx_convert_internal (valtype, retval);
 
       /* If the conversion failed, treat this just like `return;'.  */
       if (retval == error_mark_node)
Index: gcc/cp/init.c
===================================================================
--- gcc/cp/init.c	(revision 111978)
+++ gcc/cp/init.c	(working copy)
@@ -180,7 +180,7 @@
        initialized are initialized to zero.  */
     ;
   else if (SCALAR_TYPE_P (type))
-    init = convert (type, integer_zero_node);
+    init = cxx_convert_internal (type, integer_zero_node);
   else if (CLASS_TYPE_P (type))
     {
       tree field;
@@ -784,7 +784,7 @@
 		      vtt_parm,
 		      vtt_index);
       vtbl2 = build_indirect_ref (vtbl2, NULL);
-      vtbl2 = convert (TREE_TYPE (vtbl), vtbl2);
+      vtbl2 = cxx_convert_internal (TREE_TYPE (vtbl), vtbl2);
 
       /* The actual initializer is the VTT value only in the subobject
 	 constructor.  In maybe_clone_body we'll substitute NULL for
@@ -1754,7 +1754,7 @@
 	 our own VLA layout later.  */
       vla_p = true;
       full_type = build_cplus_array_type (type, NULL_TREE);
-      index = convert (sizetype, nelts);
+      index = cxx_convert_internal (sizetype, nelts);
       index = size_binop (MINUS_EXPR, index, size_one_node);
       TYPE_DOMAIN (full_type) = build_index_type (index);
     }
@@ -1800,7 +1800,7 @@
   size = size_in_bytes (elt_type);
   if (array_p)
     {
-      size = size_binop (MULT_EXPR, size, convert (sizetype, nelts));
+      size = size_binop (MULT_EXPR, size, cxx_convert_internal (sizetype, nelts));
       if (vla_p)
 	{
 	  tree n, bitsize;
@@ -1809,7 +1809,7 @@
 	     necessary in order for the <INIT_EXPR <*foo> <CONSTRUCTOR
 	     ...>> to be valid.  */
 	  TYPE_SIZE_UNIT (full_type) = size;
-	  n = convert (bitsizetype, nelts);
+	  n = cxx_convert_internal (bitsizetype, nelts);
 	  bitsize = size_binop (MULT_EXPR, TYPE_SIZE (elt_type), n);
 	  TYPE_SIZE (full_type) = bitsize;
 	}
@@ -2199,7 +2199,7 @@
 
   /* The below is short by the cookie size.  */
   virtual_size = size_binop (MULT_EXPR, size_exp,
-			     convert (sizetype, maxindex));
+			     cxx_convert_internal (sizetype, maxindex));
 
   tbase = create_temporary_var (ptype);
   tbase_init = build_modify_expr (tbase, NOP_EXPR,
@@ -2232,7 +2232,7 @@
 
       /* The below is short by the cookie size.  */
       virtual_size = size_binop (MULT_EXPR, size_exp,
-				 convert (sizetype, maxindex));
+				 cxx_convert_internal (sizetype, maxindex));
 
       if (! TYPE_VEC_NEW_USES_COOKIE (type))
 	/* no header */
@@ -2273,7 +2273,7 @@
   /* Outermost wrapper: If pointer is null, punt.  */
   body = fold_build3 (COND_EXPR, void_type_node,
 		      fold_build2 (NE_EXPR, boolean_type_node, base,
-				   convert (TREE_TYPE (base),
+				   cxx_convert_internal (TREE_TYPE (base),
 					    integer_zero_node)),
 		      body, integer_zero_node);
   body = build1 (NOP_EXPR, void_type_node, body);
Index: gcc/cp/class.c
===================================================================
--- gcc/cp/class.c	(revision 111978)
+++ gcc/cp/class.c	(working copy)
@@ -350,7 +350,7 @@
 
 	  t = TREE_TYPE (TYPE_VFIELD (current_class_type));
 	  t = build_pointer_type (t);
-	  v_offset = convert (t, current_vtt_parm);
+	  v_offset = cxx_convert_internal (t, current_vtt_parm);
 	  v_offset = build_indirect_ref (v_offset, NULL);
 	}
       else
@@ -1325,9 +1325,9 @@
 	      /* A virtual binfo might have been copied from within
 		 another hierarchy. As we're about to use it as a
 		 primary base, make sure the offsets match.  */
-	      delta = size_diffop (convert (ssizetype,
+	      delta = size_diffop (cxx_convert_internal (ssizetype,
 					    BINFO_OFFSET (base_binfo)),
-				   convert (ssizetype,
+				   cxx_convert_internal (ssizetype,
 					    BINFO_OFFSET (this_primary)));
 
 	      propagate_binfo_offsets (this_primary, delta);
@@ -1389,7 +1389,7 @@
 	     another hierarchy. As we're about to use it as a primary
 	     base, make sure the offsets match.  */
 	  delta = size_diffop (ssize_int (0),
-			       convert (ssizetype, BINFO_OFFSET (primary)));
+			       cxx_convert_internal (ssizetype, BINFO_OFFSET (primary)));
 
 	  propagate_binfo_offsets (primary, delta);
 	}
@@ -2071,14 +2071,14 @@
 	  if (virtual_offset
 	      || (thunk_binfo && !BINFO_OFFSET_ZEROP (thunk_binfo)))
 	    {
-	      tree offset = convert (ssizetype, BINFO_OFFSET (thunk_binfo));
+	      tree offset = cxx_convert_internal (ssizetype, BINFO_OFFSET (thunk_binfo));
 
 	      if (virtual_offset)
 		{
 		  /* We convert via virtual base.  Adjust the fixed
 		     offset to be from there.  */
 		  offset = size_diffop
-		    (offset, convert
+		    (offset, cxx_convert_internal
 		     (ssizetype, BINFO_OFFSET (virtual_offset)));
 		}
 	      if (fixed_offset)
@@ -2161,8 +2161,8 @@
   if (virtual_base)
     /* The `this' pointer needs to be adjusted from the declaration to
        the nearest virtual base.  */
-    delta = size_diffop (convert (ssizetype, BINFO_OFFSET (virtual_base)),
-			 convert (ssizetype, BINFO_OFFSET (first_defn)));
+    delta = size_diffop (cxx_convert_internal (ssizetype, BINFO_OFFSET (virtual_base)),
+			 cxx_convert_internal (ssizetype, BINFO_OFFSET (first_defn)));
   else if (lost)
     /* If the nearest definition is in a lost primary, we don't need an
        entry in our vtable.  Except possibly in a constructor vtable,
@@ -2174,9 +2174,9 @@
        BINFO to pointing at the base where the final overrider
        appears.  */
     virtual_covariant:
-    delta = size_diffop (convert (ssizetype,
+    delta = size_diffop (cxx_convert_internal (ssizetype,
 				  BINFO_OFFSET (TREE_VALUE (overrider))),
-			 convert (ssizetype, BINFO_OFFSET (binfo)));
+			 cxx_convert_internal (ssizetype, BINFO_OFFSET (binfo)));
 
   modify_vtable_entry (t, binfo, overrider_fn, delta, virtuals);
 
@@ -2679,7 +2679,7 @@
 
   if (w != error_mark_node)
     {
-      DECL_SIZE (field) = convert (bitsizetype, w);
+      DECL_SIZE (field) = cxx_convert_internal (bitsizetype, w);
       DECL_BIT_FIELD (field) = 1;
     }
   else
@@ -3459,8 +3459,8 @@
        hierarchy.  Therefore, we may not need to add the entire
        OFFSET.  */
     propagate_binfo_offsets (binfo,
-			     size_diffop (convert (ssizetype, offset),
-					  convert (ssizetype,
+			     size_diffop (cxx_convert_internal (ssizetype, offset),
+					  cxx_convert_internal (ssizetype,
 						   BINFO_OFFSET (binfo))));
 }
 
@@ -3513,7 +3513,7 @@
       /* That didn't work.  Now, we move forward from the next
 	 available spot in the class.  */
       atend = true;
-      propagate_binfo_offsets (binfo, convert (ssizetype, eoc));
+      propagate_binfo_offsets (binfo, cxx_convert_internal (ssizetype, eoc));
       while (1)
 	{
 	  if (!layout_conflict_p (binfo,
@@ -4261,9 +4261,9 @@
 
   /* Update BINFO's offset.  */
   BINFO_OFFSET (binfo)
-    = convert (sizetype,
+    = cxx_convert_internal (sizetype,
 	       size_binop (PLUS_EXPR,
-			   convert (ssizetype, BINFO_OFFSET (binfo)),
+			   cxx_convert_internal (ssizetype, BINFO_OFFSET (binfo)),
 			   offset));
 
   /* Find the primary base class.  */
@@ -4515,7 +4515,7 @@
 	= size_binop (PLUS_EXPR,
 		      rli->bitpos,
 		      size_binop (MULT_EXPR,
-				  convert (bitsizetype,
+				  cxx_convert_internal (bitsizetype,
 					   size_binop (MINUS_EXPR,
 						       eoc, rli_size)),
 				  bitsize_int (BITS_PER_UNIT)));
@@ -4799,7 +4799,7 @@
 	  eoc = end_of_class (t, /*include_virtuals_p=*/0);
 	  TYPE_SIZE_UNIT (base_t)
 	    = size_binop (MAX_EXPR,
-			  convert (sizetype,
+			  cxx_convert_internal (sizetype,
 				   size_binop (CEIL_DIV_EXPR,
 					       rli_size_so_far (rli),
 					       bitsize_int (BITS_PER_UNIT))),
@@ -4808,7 +4808,7 @@
 	    = size_binop (MAX_EXPR,
 			  rli_size_so_far (rli),
 			  size_binop (MULT_EXPR,
-				      convert (bitsizetype, eoc),
+				      cxx_convert_internal (bitsizetype, eoc),
 				      bitsize_int (BITS_PER_UNIT)));
 	}
       TYPE_ALIGN (base_t) = rli->record_align;
@@ -7453,7 +7453,7 @@
       /* Figure out where we can find this vbase offset.  */
       delta = size_binop (MULT_EXPR,
 			  vid->index,
-			  convert (ssizetype,
+			  cxx_convert_internal (ssizetype,
 				   TYPE_SIZE_UNIT (vtable_entry_type)));
       if (vid->primary_vtbl_p)
 	BINFO_VPTR_FIELD (b) = delta;
Index: gcc/cp/call.c
===================================================================
--- gcc/cp/call.c	(revision 111978)
+++ gcc/cp/call.c	(working copy)
@@ -4415,7 +4415,7 @@
   if (issue_conversion_warnings)
     expr = convert_and_check (totype, expr);
   else
-    expr = convert (totype, expr);
+    expr = cxx_convert_internal (totype, expr);
 
   return expr;
 }
@@ -4497,7 +4497,7 @@
       /* Undefined behavior [expr.call] 5.2.2/7.  */
       warning (0, "cannot receive objects of non-POD type %q#T through %<...%>; "
 	       "call will abort at runtime", type);
-      expr = convert (build_pointer_type (type), null_node);
+      expr = cxx_convert_internal (build_pointer_type (type), null_node);
       expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr),
 		     call_builtin_trap (), expr);
       expr = build_indirect_ref (expr, NULL);
@@ -4917,7 +4917,7 @@
 	  t = implicit_built_in_decls[BUILT_IN_MEMCPY];
 	  t = build_call (t, args);
 
-	  t = convert (TREE_TYPE (TREE_VALUE (args)), t);
+	  t = cxx_convert_internal (TREE_TYPE (TREE_VALUE (args)), t);
 	  val = build_indirect_ref (t, 0);
 	}
 
@@ -5028,7 +5028,7 @@
       return error_mark_node;
     }
   iface_ref = build_address (iface_ref);
-  iface_ref = convert (build_pointer_type (iface), iface_ref);
+  iface_ref = cxx_convert_internal (build_pointer_type (iface), iface_ref);
 
   /* Determine the itable index of FN.  */
   i = 1;
Index: gcc/cp/method.c
===================================================================
--- gcc/cp/method.c	(revision 111978)
+++ gcc/cp/method.c	(working copy)
@@ -100,7 +100,7 @@
     virtual_offset
       = size_binop (MULT_EXPR,
 		    virtual_offset,
-		    convert (ssizetype,
+		    cxx_convert_internal (ssizetype,
 			     TYPE_SIZE_UNIT (vtable_entry_type)));
 
   d = tree_low_cst (fixed_offset, 0);
Index: gcc/cp/rtti.c
===================================================================
--- gcc/cp/rtti.c	(revision 111978)
+++ gcc/cp/rtti.c	(working copy)
@@ -253,7 +253,7 @@
       index = build_int_cst (NULL_TREE,
 			     -1 * TARGET_VTABLE_DATA_ENTRY_DISTANCE);
       t = build_vtbl_ref (exp, index);
-      t = convert (type_info_ptr_type, t);
+      t = cxx_convert_internal (type_info_ptr_type, t);
     }
   else
     /* Otherwise return the type_info for the static type of the expr.  */
@@ -1061,7 +1061,7 @@
 		/* We store the vtable offset at which the virtual
        		   base offset can be found.  */
 		offset = BINFO_VPTR_FIELD (base_binfo);
-		offset = convert (sizetype, offset);
+		offset = cxx_convert_internal (sizetype, offset);
 		flags |= 1;
 	      }
 	    else
Index: gcc/cp/except.c
===================================================================
--- gcc/cp/except.c	(revision 111978)
+++ gcc/cp/except.c	(working copy)
@@ -149,7 +149,7 @@
 
   mark_used (exp);
 
-  return convert (ptr_type_node, build_address (exp));
+  return cxx_convert_internal (ptr_type_node, build_address (exp));
 }
 
 tree
Index: gcc/cp/cvt.c
===================================================================
--- gcc/cp/cvt.c	(revision 111978)
+++ gcc/cp/cvt.c	(working copy)
@@ -977,7 +977,7 @@
    do a little bit more work.  */
 
 tree
-convert (tree type, tree expr)
+cxx_convert_internal (tree type, tree expr)
 {
   tree intype;
 
Index: gcc/cp/tree.c
===================================================================
--- gcc/cp/tree.c	(revision 111978)
+++ gcc/cp/tree.c	(working copy)
@@ -280,7 +280,7 @@
   abstract_virtuals_error (NULL_TREE, type);
 
   if (TREE_CODE (init) != CALL_EXPR && TREE_CODE (init) != AGGR_INIT_EXPR)
-    return convert (type, init);
+    return cxx_convert_internal (type, init);
 
   fn = TREE_OPERAND (init, 0);
   is_ctor = (TREE_CODE (fn) == ADDR_EXPR
Index: gcc/cp/cp-tree.h
===================================================================
--- gcc/cp/cp-tree.h	(revision 111978)
+++ gcc/cp/cp-tree.h	(working copy)
@@ -3789,6 +3789,8 @@
 extern tree perform_qualification_conversions	(tree, tree);
 extern void clone_function_decl			(tree, int);
 extern void adjust_clone_args			(tree);
+extern tree cxx_convert                         (tree type, tree expr);
+extern tree cxx_convert_internal                (tree type, tree expr);
 
 /* decl.c */
 extern tree poplevel				(int, int, int);
Index: gcc/cp/cp-gimplify.c
===================================================================
--- gcc/cp/cp-gimplify.c	(revision 111978)
+++ gcc/cp/cp-gimplify.c	(working copy)
@@ -630,7 +630,7 @@
   if (TREE_CODE (stmt) == ADDR_EXPR
       && is_invisiref_parm (TREE_OPERAND (stmt, 0)))
     {
-      *stmt_p = convert (TREE_TYPE (stmt), TREE_OPERAND (stmt, 0));
+      *stmt_p = cxx_convert_internal (TREE_TYPE (stmt), TREE_OPERAND (stmt, 0));
       *walk_subtrees = 0;
     }
   else if (TREE_CODE (stmt) == RETURN_EXPR
Index: gcc/cp/decl2.c
===================================================================
--- gcc/cp/decl2.c	(revision 111978)
+++ gcc/cp/decl2.c	(working copy)
@@ -2028,13 +2028,13 @@
     {
       guard_value = integer_one_node;
       if (!same_type_p (TREE_TYPE (guard_value), TREE_TYPE (guard)))
-	guard_value = convert (TREE_TYPE (guard), guard_value);
+	guard_value = cxx_convert_internal (TREE_TYPE (guard), guard_value);
 	guard = cp_build_binary_op (BIT_AND_EXPR, guard, guard_value);
     }
 
   guard_value = integer_zero_node;
   if (!same_type_p (TREE_TYPE (guard_value), TREE_TYPE (guard)))
-    guard_value = convert (TREE_TYPE (guard), guard_value);
+    guard_value = cxx_convert_internal (TREE_TYPE (guard), guard_value);
   return cp_build_binary_op (EQ_EXPR, guard, guard_value);
 }
 
@@ -2050,7 +2050,7 @@
   guard = get_guard_bits (guard);
   guard_init = integer_one_node;
   if (!same_type_p (TREE_TYPE (guard_init), TREE_TYPE (guard)))
-    guard_init = convert (TREE_TYPE (guard), guard_init);
+    guard_init = cxx_convert_internal (TREE_TYPE (guard), guard_init);
   return build_modify_expr (guard, NOP_EXPR, guard_init);
 }
 
Index: gcc/tree-ssa-ccp.c
===================================================================
--- gcc/tree-ssa-ccp.c	(revision 111978)
+++ gcc/tree-ssa-ccp.c	(working copy)
@@ -1879,7 +1879,7 @@
 	      if (TREE_CODE (min_idx) != INTEGER_CST)
 		break;
 
-	      array_idx = convert (TREE_TYPE (min_idx), array_idx);
+	      array_idx = convert2 (TREE_TYPE (min_idx), array_idx);
 	      if (!integer_zerop (min_idx))
 		array_idx = int_const_binop (MINUS_EXPR, array_idx,
 					     min_idx, 0);
@@ -1887,7 +1887,7 @@
 	}
 
       /* Convert the index to a byte offset.  */
-      array_idx = convert (sizetype, array_idx);
+      array_idx = convert2 (sizetype, array_idx);
       array_idx = int_const_binop (MULT_EXPR, array_idx, elt_size, 0);
 
       /* Update the operands for the next round, or for folding.  */
Index: gcc/dojump.c
===================================================================
--- gcc/dojump.c	(revision 111978)
+++ gcc/dojump.c	(working copy)
@@ -277,7 +277,7 @@
           && (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
               != CODE_FOR_nothing))
         {
-          do_jump (convert (type, exp), if_false_label, if_true_label);
+          do_jump (convert2 (type, exp), if_false_label, if_true_label);
           break;
         }
       goto normal;
@@ -336,7 +336,7 @@
             && (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
 		!= CODE_FOR_nothing))
           {
-            do_jump (convert (type, exp), if_false_label, if_true_label);
+            do_jump (convert2 (type, exp), if_false_label, if_true_label);
             break;
           }
         goto normal;
Index: gcc/c-tree.h
===================================================================
--- gcc/c-tree.h	(revision 111978)
+++ gcc/c-tree.h	(working copy)
@@ -436,6 +436,8 @@
 extern tree pop_scope (void);
 extern void insert_block (tree);
 extern void c_expand_body (tree);
+extern tree c_convert (tree type, tree expr);
+extern tree c_convert_internal (tree type, tree expr);
 
 extern void c_init_decl_processing (void);
 extern void c_dup_lang_specific_decl (tree);
Index: gcc/expr.c
===================================================================
--- gcc/expr.c	(revision 111978)
+++ gcc/expr.c	(working copy)
@@ -4229,11 +4229,11 @@
 	{
 	  if (TYPE_UNSIGNED (TREE_TYPE (exp))
 	      != SUBREG_PROMOTED_UNSIGNED_P (target))
-	    exp = convert
+	    exp = convert2
 	      (lang_hooks.types.signed_or_unsigned_type
 	       (SUBREG_PROMOTED_UNSIGNED_P (target), TREE_TYPE (exp)), exp);
 
-	  exp = convert (lang_hooks.types.type_for_mode
+	  exp = convert2 (lang_hooks.types.type_for_mode
 			 (GET_MODE (SUBREG_REG (target)),
 			  SUBREG_PROMOTED_UNSIGNED_P (target)),
 			 exp);
@@ -4904,7 +4904,7 @@
 		  {
 		    type = lang_hooks.types.type_for_size
 		      (BITS_PER_WORD, TYPE_UNSIGNED (type));
-		    value = convert (type, value);
+		    value = convert2 (type, value);
 		  }
 		
 		if (BYTES_BIG_ENDIAN)
@@ -5109,11 +5109,11 @@
 
 		    /* Assign value to element index.  */
 		    position
-		      = convert (ssizetype,
+		      = convert2 (ssizetype,
 				 fold_build2 (MINUS_EXPR, TREE_TYPE (index),
 					      index, TYPE_MIN_VALUE (domain)));
 		    position = size_binop (MULT_EXPR, position,
-					   convert (ssizetype,
+					   convert2 (ssizetype,
 						    TYPE_SIZE_UNIT (elttype)));
 		    
 		    pos_rtx = expand_normal (position);
@@ -5159,7 +5159,7 @@
 						     TYPE_MIN_VALUE (domain)));
 		
 		position = size_binop (MULT_EXPR, index,
-				       convert (ssizetype,
+				       convert2 (ssizetype,
 						TYPE_SIZE_UNIT (elttype)));
 		xtarget = offset_address (target,
 					  expand_normal (position),
@@ -5613,7 +5613,7 @@
 
 	    offset = size_binop (PLUS_EXPR, offset,
 			         size_binop (MULT_EXPR,
-					     convert (sizetype, index),
+					     convert2 (sizetype, index),
 					     unit_size));
 	  }
 	  break;
@@ -5652,7 +5652,7 @@
   /* If OFFSET is constant, see if we can return the whole thing as a
      constant bit position.  Otherwise, split it up.  */
   if (host_integerp (offset, 0)
-      && 0 != (tem = size_binop (MULT_EXPR, convert (bitsizetype, offset),
+      && 0 != (tem = size_binop (MULT_EXPR, convert2 (bitsizetype, offset),
 				 bitsize_unit_node))
       && 0 != (tem = size_binop (PLUS_EXPR, tem, bit_offset))
       && host_integerp (tem, 0))
@@ -8445,7 +8445,7 @@
 	    do_jump (TREE_OPERAND (rhs, 1),
 		     TREE_CODE (rhs) == BIT_IOR_EXPR ? label : 0,
 		     TREE_CODE (rhs) == BIT_AND_EXPR ? label : 0);
-	    expand_assignment (lhs, convert (TREE_TYPE (rhs),
+	    expand_assignment (lhs, convert2 (TREE_TYPE (rhs),
 					     (TREE_CODE (rhs) == BIT_IOR_EXPR
 					      ? integer_one_node
 					      : integer_zero_node)));
@@ -8768,7 +8768,7 @@
 
   if (TREE_CODE (array) == STRING_CST)
     {
-      *ptr_offset = convert (sizetype, offset);
+      *ptr_offset = convert2 (sizetype, offset);
       return array;
     }
   else if (TREE_CODE (array) == VAR_DECL)
@@ -8795,7 +8795,7 @@
 
       /* If variable is bigger than the string literal, OFFSET must be constant
 	 and inside of the bounds of the string literal.  */
-      offset = convert (sizetype, offset);
+      offset = convert2 (sizetype, offset);
       if (compare_tree_int (DECL_SIZE_UNIT (array), length) > 0
 	  && (! host_integerp (offset, 1)
 	      || compare_tree_int (offset, length) >= 0))
@@ -9107,7 +9107,7 @@
     {
       if (TYPE_MODE (index_type) != index_mode)
 	{
-	  index_expr = convert (lang_hooks.types.type_for_size
+	  index_expr = convert2 (lang_hooks.types.type_for_size
 				(index_bits, 0), index_expr);
 	  index_type = TREE_TYPE (index_expr);
 	}
@@ -9235,8 +9235,8 @@
     return 0;
 
   index_expr = fold_build2 (MINUS_EXPR, index_type,
-			    convert (index_type, index_expr),
-			    convert (index_type, minval));
+			    convert2 (index_type, index_expr),
+			    convert2 (index_type, minval));
   index = expand_normal (index_expr);
   do_pending_stack_adjust ();
 
Index: gcc/expr.h
===================================================================
--- gcc/expr.h	(revision 111978)
+++ gcc/expr.h	(working copy)
@@ -129,10 +129,10 @@
   if (host_integerp (inc, 0))				\
     (TO).constant += tree_low_cst (inc, 0);		\
   else if ((TO).var == 0)				\
-    (TO).var = convert (ssizetype, inc);		\
+    (TO).var = convert2 (ssizetype, inc);		\
   else							\
     (TO).var = size_binop (PLUS_EXPR, (TO).var,		\
-			   convert (ssizetype, inc));	\
+			   convert2 (ssizetype, inc));	\
 } while (0)
 
 #define SUB_PARM_SIZE(TO, DEC)				\
@@ -142,17 +142,17 @@
     (TO).constant -= tree_low_cst (dec, 0);		\
   else if ((TO).var == 0)				\
     (TO).var = size_binop (MINUS_EXPR, ssize_int (0),	\
-			   convert (ssizetype, dec));	\
+			   convert2 (ssizetype, dec));	\
   else							\
     (TO).var = size_binop (MINUS_EXPR, (TO).var,	\
-			   convert (ssizetype, dec));	\
+			   convert2 (ssizetype, dec));	\
 } while (0)
 
 /* Convert the implicit sum in a `struct args_size' into a tree
    of type ssizetype.  */
 #define ARGS_SIZE_TREE(SIZE)					\
 ((SIZE).var == 0 ? ssize_int ((SIZE).constant)			\
- : size_binop (PLUS_EXPR, convert (ssizetype, (SIZE).var),	\
+ : size_binop (PLUS_EXPR, convert2 (ssizetype, (SIZE).var),	\
 	       ssize_int ((SIZE).constant)))
 
 /* Convert the implicit sum in a `struct args_size' into an rtx.  */
Index: gcc/ada/trans.c
===================================================================
--- gcc/ada/trans.c	(revision 111978)
+++ gcc/ada/trans.c	(working copy)
@@ -405,7 +405,7 @@
 	  && DECL_BY_COMPONENT_PTR_P (gnu_result))
 	gnu_result
 	  = build_unary_op (INDIRECT_REF, NULL_TREE,
-			    convert (build_pointer_type (gnu_result_type),
+			    gnat_convert_internal (build_pointer_type (gnu_result_type),
 				     gnu_result));
 
       /* If it's a renaming pointer and we are at the right binding level,
@@ -595,7 +595,7 @@
 	= build_binary_op (attribute == Attr_Pred
 			   ? MINUS_EXPR : PLUS_EXPR,
 			   gnu_result_type, gnu_expr,
-			   convert (gnu_result_type, integer_one_node));
+			   gnat_convert_internal (gnu_result_type, integer_one_node));
       break;
 
     case Attr_Address:
@@ -650,7 +650,7 @@
 	   template address.*/
 	if (TYPE_FAT_POINTER_P (TREE_TYPE (gnu_ptr)))
 	  gnu_ptr
-	    = convert (build_pointer_type
+	    = gnat_convert_internal (build_pointer_type
 		       (TYPE_OBJECT_RECORD_TYPE
 			(TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (gnu_ptr)))),
 		       gnu_ptr);
@@ -662,15 +662,15 @@
 	    tree gnu_char_ptr_type = build_pointer_type (char_type_node);
 	    tree gnu_pos = byte_position (TYPE_FIELDS (gnu_obj_type));
 	    tree gnu_byte_offset
-	      = convert (gnu_char_ptr_type,
+	      = gnat_convert_internal (gnu_char_ptr_type,
 			 size_diffop (size_zero_node, gnu_pos));
 
-	    gnu_ptr = convert (gnu_char_ptr_type, gnu_ptr);
+	    gnu_ptr = gnat_convert_internal (gnu_char_ptr_type, gnu_ptr);
 	    gnu_ptr = build_binary_op (MINUS_EXPR, gnu_char_ptr_type,
 				       gnu_ptr, gnu_byte_offset);
 	  }
 
-	gnu_result = convert (gnu_result_type, gnu_ptr);
+	gnu_result = gnat_convert_internal (gnu_result_type, gnu_ptr);
       }
       break;
 
@@ -779,7 +779,7 @@
 	 ??? Size should be calculated in storage elements directly.  */
 
       if (attribute == Attr_Max_Size_In_Storage_Elements)
-	gnu_result = convert (sizetype,
+	gnu_result = gnat_convert_internal (sizetype,
 			      fold (build2 (CEIL_DIV_EXPR, bitsizetype,
 					    gnu_result, bitsize_unit_node)));
       break;
@@ -822,12 +822,12 @@
 		 (PLUS_EXPR, get_base_type (gnu_result_type),
 		  build_binary_op (MINUS_EXPR,
 				   get_base_type (gnu_result_type),
-				   convert (gnu_result_type,
+				   gnat_convert_internal (gnu_result_type,
 					    TYPE_MAX_VALUE (gnu_type)),
-				   convert (gnu_result_type,
+				   gnat_convert_internal (gnu_result_type,
 					    TYPE_MIN_VALUE (gnu_type))),
-		  convert (gnu_result_type, integer_one_node)),
-		 convert (gnu_result_type, integer_zero_node));
+		  gnat_convert_internal (gnu_result_type, integer_one_node)),
+		 gnat_convert_internal (gnu_result_type, integer_zero_node));
 
 	  break;
 	}
@@ -885,14 +885,14 @@
 		 (PLUS_EXPR, gnu_compute_type,
 		  build_binary_op
 		  (MINUS_EXPR, gnu_compute_type,
-		   convert (gnu_compute_type,
+		   gnat_convert_internal (gnu_compute_type,
 			    TYPE_MAX_VALUE
 			    (TYPE_INDEX_TYPE (TYPE_DOMAIN (gnu_type)))),
-		   convert (gnu_compute_type,
+		   gnat_convert_internal (gnu_compute_type,
 			    TYPE_MIN_VALUE
 			    (TYPE_INDEX_TYPE (TYPE_DOMAIN (gnu_type))))),
-		  convert (gnu_compute_type, integer_one_node)),
-		 convert (gnu_compute_type, integer_zero_node));
+		  gnat_convert_internal (gnu_compute_type, integer_one_node)),
+		 gnat_convert_internal (gnu_compute_type, integer_zero_node));
 	  }
 
 	/* If this has a PLACEHOLDER_EXPR, qualify it by the object we are
@@ -1049,7 +1049,7 @@
       gnu_result_type = get_unpadded_type (Etype (gnat_node));
       gnu_result
 	= build_unary_op (INDIRECT_REF, NULL_TREE,
-			  convert (build_pointer_type (gnu_result_type),
+			  gnat_convert_internal (build_pointer_type (gnu_result_type),
 				   integer_zero_node));
       TREE_PRIVATE (gnu_result) = 1;
       break;
@@ -1079,7 +1079,7 @@
 			   && (DECL_BY_COMPONENT_PTR_P
 			       (get_gnu_tree (gnat_obj))))))
 		  ? By_Reference : By_Copy);
-	gnu_result = convert (gnu_result_type, size_int (- code));
+	gnu_result = gnat_convert_internal (gnu_result_type, size_int (- code));
       }
       break;
 
@@ -1117,7 +1117,7 @@
   Node_Id gnat_when;
 
   gnu_expr = gnat_to_gnu (Expression (gnat_node));
-  gnu_expr = convert (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr);
+  gnu_expr = gnat_convert_internal (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr);
 
   /*  The range of values in a case statement is determined by the rules in
       RM 5.4(7-9). In almost all cases, this range is represented by the Etype
@@ -1133,7 +1133,7 @@
   if (Paren_Count (Expression (gnat_node)) != 0
       || !Is_OK_Static_Subtype (Underlying_Type
 				(Etype (Expression (gnat_node)))))
-    gnu_expr = convert (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr);
+    gnu_expr = gnat_convert_internal (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr);
 
   /* We build a SWITCH_EXPR that contains the code with interspersed
      CASE_LABEL_EXPRs for each label.  */
@@ -1296,7 +1296,7 @@
 
       /* The loop variable might be a padded type, so use `convert' to get a
 	 reference to the inner variable if so.  */
-      gnu_loop_var = convert (get_base_type (gnu_type), gnu_loop_var);
+      gnu_loop_var = gnat_convert_internal (get_base_type (gnu_type), gnu_loop_var);
 
       /* Set either the top or bottom exit condition as appropriate depending
 	 on whether or not we know an overflow cannot occur. */
@@ -1314,7 +1314,7 @@
 			   : PREINCREMENT_EXPR,
 			   TREE_TYPE (gnu_loop_var),
 			   gnu_loop_var,
-			   convert (TREE_TYPE (gnu_loop_var),
+			   gnat_convert_internal (TREE_TYPE (gnu_loop_var),
 				    integer_one_node));
       annotate_with_node (LOOP_STMT_UPDATE (gnu_loop_stmt),
 			  gnat_iter_scheme);
@@ -1497,7 +1497,7 @@
 
 	/* Do any needed references for padded types.  */
 	TREE_VALUE (gnu_cico_list)
-	  = convert (TREE_TYPE (TREE_PURPOSE (gnu_cico_list)),
+	  = gnat_convert_internal (TREE_TYPE (TREE_PURPOSE (gnu_cico_list)),
 		     gnat_to_gnu_entity (gnat_param, NULL_TREE, 1));
       }
 
@@ -1773,7 +1773,7 @@
 		gnu_name = gnu_copy = TREE_OPERAND (gnu_name, 0);
 	      else if (TREE_CODE (gnu_name_type) == RECORD_TYPE
 		       && (TYPE_JUSTIFIED_MODULAR_P (gnu_name_type)))
-		gnu_name = convert (gnu_name_type, gnu_name);
+		gnu_name = gnat_convert_internal (gnu_name_type, gnu_name);
 
 	      gnu_actual = save_expr (gnu_name);
 
@@ -1804,7 +1804,7 @@
       if (Ekind (gnat_formal) != E_Out_Parameter
 	  && TREE_CODE (TREE_TYPE (gnu_actual)) == RECORD_TYPE
 	  && TYPE_IS_PADDING_P (TREE_TYPE (gnu_actual)))
-	gnu_actual = convert (get_unpadded_type (Etype (gnat_actual)),
+	gnu_actual = gnat_convert_internal (get_unpadded_type (Etype (gnat_actual)),
 			      gnu_actual);
 
       /* Unless this is an In parameter, we must remove any LJM building
@@ -1813,7 +1813,7 @@
 	  && TREE_CODE (gnu_name) == CONSTRUCTOR
 	  && TREE_CODE (TREE_TYPE (gnu_name)) == RECORD_TYPE
 	  && TYPE_JUSTIFIED_MODULAR_P (TREE_TYPE (gnu_name)))
-	gnu_name = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_name))),
+	gnu_name = gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_name))),
 			    gnu_name);
 
       if (Ekind (gnat_formal) != E_Out_Parameter
@@ -1843,11 +1843,11 @@
       else if (TREE_CODE (gnu_actual) != SAVE_EXPR)
 	/* We may have suppressed a conversion to the Etype of the actual since
 	   the parent is a procedure call.  So add the conversion here.  */
-	gnu_actual = convert (gnat_to_gnu_type (Etype (gnat_actual)),
+	gnu_actual = gnat_convert_internal (gnat_to_gnu_type (Etype (gnat_actual)),
 			      gnu_actual);
 
       if (TREE_CODE (gnu_actual) != SAVE_EXPR)
-	gnu_actual = convert (gnu_formal_type, gnu_actual);
+	gnu_actual = gnat_convert_internal (gnu_formal_type, gnu_actual);
 
       /* If we have not saved a GCC object for the formal, it means it is an
 	 OUT parameter not passed by reference and that does not need to be
@@ -1864,7 +1864,7 @@
 	      if (TREE_CODE (TREE_TYPE (gnu_actual)) == RECORD_TYPE
 		  && TYPE_IS_PADDING_P (TREE_TYPE (gnu_actual))
 		  && TREE_CODE (gnu_actual) != SAVE_EXPR)
-		gnu_actual = convert (get_unpadded_type (Etype (gnat_actual)),
+		gnu_actual = gnat_convert_internal (get_unpadded_type (Etype (gnat_actual)),
 				      gnu_actual);
 
 	      /* If we have the constructed subtype of an aliased object
@@ -1878,7 +1878,7 @@
 		  && TREE_CODE (gnu_actual) != SAVE_EXPR
 		  && Is_Constr_Subt_For_UN_Aliased (Etype (gnat_actual))
 		  && Is_Array_Type (Etype (gnat_actual)))
-		gnu_actual = convert (gnat_to_gnu_type (Etype (gnat_actual)),
+		gnu_actual = gnat_convert_internal (gnat_to_gnu_type (Etype (gnat_actual)),
 				      gnu_actual);
 	    }
 
@@ -1911,7 +1911,7 @@
 	      && TYPE_IS_PADDING_P (gnu_formal_type))
 	    {
 	      gnu_formal_type = TREE_TYPE (TYPE_FIELDS (gnu_formal_type));
-	      gnu_actual = convert (gnu_formal_type, gnu_actual);
+	      gnu_actual = gnat_convert_internal (gnu_formal_type, gnu_actual);
 	    }
 
 	  /* Take the address of the object and convert to the proper pointer
@@ -1920,7 +1920,7 @@
 	     possibility that the ARRAY_REF might return a constant and we'd be
 	     getting the wrong address.  Neither approach is exactly correct,
 	     but this is the most likely to work in all cases.  */
-	  gnu_actual = convert (gnu_formal_type,
+	  gnu_actual = gnat_convert_internal (gnu_formal_type,
 				build_unary_op (ADDR_EXPR, NULL_TREE,
 						gnu_actual));
 	}
@@ -1931,7 +1931,7 @@
 	  if ((TREE_CODE (gnu_actual) == INDIRECT_REF
 	       || TREE_CODE (gnu_actual) == UNCONSTRAINED_ARRAY_REF)
 	      && TREE_PRIVATE (gnu_actual))
-	    gnu_actual = convert (DECL_ARG_TYPE (get_gnu_tree (gnat_formal)),
+	    gnu_actual = gnat_convert_internal (DECL_ARG_TYPE (get_gnu_tree (gnat_formal)),
 				  integer_zero_node);
 	  else
 	    gnu_actual = build_unary_op (ADDR_EXPR, NULL_TREE,
@@ -1957,13 +1957,13 @@
 						   BITS_PER_WORD))
 	    gnu_actual
 	      = unchecked_convert (DECL_ARG_TYPE (gnu_formal),
-				   convert (gnat_type_for_size
+				   gnat_convert_internal (gnat_type_for_size
 					    (tree_low_cst (gnu_actual_size, 1),
 					     1),
 					    integer_zero_node),
 				   false);
 	  else
-	    gnu_actual = convert (DECL_ARG_TYPE (gnu_formal), gnu_actual);
+	    gnu_actual = gnat_convert_internal (DECL_ARG_TYPE (gnu_formal), gnu_actual);
 	}
 
       gnu_actual_list = tree_cons (NULL_TREE, gnu_actual, gnu_actual_list);
@@ -2070,7 +2070,7 @@
 	    /* If the result is a padded type, remove the padding.  */
 	    if (TREE_CODE (TREE_TYPE (gnu_result)) == RECORD_TYPE
 		&& TYPE_IS_PADDING_P (TREE_TYPE (gnu_result)))
-	      gnu_result = convert (TREE_TYPE (TYPE_FIELDS
+	      gnu_result = gnat_convert_internal (TREE_TYPE (TYPE_FIELDS
 					       (TREE_TYPE (gnu_result))),
 				    gnu_result);
 
@@ -2095,7 +2095,7 @@
 
 		if (!(!TREE_CONSTANT (TYPE_SIZE (TREE_TYPE (gnu_actual)))
 		      && TREE_CONSTANT (TYPE_SIZE (TREE_TYPE (gnu_result)))))
-		  gnu_result = convert (TREE_TYPE (gnu_actual), gnu_result);
+		  gnu_result = gnat_convert_internal (TREE_TYPE (gnu_actual), gnu_result);
 	      }
 
 	    gnu_result = build_binary_op (MODIFY_EXPR, NULL_TREE,
@@ -2335,7 +2335,7 @@
 	    this_choice
 	      = build_binary_op
 		(EQ_EXPR, integer_type_node,
-		 convert
+		 gnat_convert_internal
 		 (integer_type_node,
 		  build_component_ref
 		  (build_unary_op
@@ -2362,7 +2362,7 @@
 	  this_choice
 	    = build_binary_op
 	      (EQ_EXPR, integer_type_node, TREE_VALUE (gnu_except_ptr_stack),
-	       convert (TREE_TYPE (TREE_VALUE (gnu_except_ptr_stack)),
+	       gnat_convert_internal (TREE_TYPE (TREE_VALUE (gnu_except_ptr_stack)),
 			build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr)));
 
 	  /* If this is the distinguished exception "Non_Ada_Error" (and we are
@@ -2720,7 +2720,7 @@
 	     convert it to a machine number if it isn't already.  That
 	     forces BASE to 0 or 2 and simplifies the rest of our logic.  */
 	  if (UR_Is_Zero (ur_realval))
-	    gnu_result = convert (gnu_result_type, integer_zero_node);
+	    gnu_result = gnat_convert_internal (gnu_result_type, integer_zero_node);
 	  else
 	    {
 	      if (!Is_Machine_Number (gnat_node))
@@ -2942,7 +2942,7 @@
 	if (TREE_CODE (TREE_TYPE (gnu_array_object)) == RECORD_TYPE
 	    && TYPE_IS_PADDING_P (TREE_TYPE (gnu_array_object)))
 	  gnu_array_object
-	    = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_array_object))),
+	    = gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_array_object))),
 		       gnu_array_object);
 
 	gnu_result = gnu_array_object;
@@ -3033,8 +3033,8 @@
             /* Build a compound expression that does the range checks */
             gnu_expr
               = build_binary_op (COMPOUND_EXPR, gnu_expr_type,
-                                 convert (gnu_expr_type, gnu_expr_h),
-                                 convert (gnu_expr_type, gnu_expr_l));
+                                 gnat_convert_internal (gnu_expr_type, gnu_expr_h),
+                                 gnat_convert_internal (gnu_expr_type, gnu_expr_l));
 
             /* Build a conditional expression that returns the range checks
                expression if the slice range is not null (max >= min) or
@@ -3042,9 +3042,9 @@
             gnu_expr
               = fold (build3 (COND_EXPR, gnu_expr_type,
 			      build_binary_op (GE_EXPR, gnu_expr_type,
-					       convert (gnu_expr_type,
+					       gnat_convert_internal (gnu_expr_type,
 							gnu_max_expr),
-					       convert (gnu_expr_type,
+					       gnat_convert_internal (gnu_expr_type,
 							gnu_min_expr)),
 			      gnu_expr, gnu_min_expr));
           }
@@ -3188,7 +3188,7 @@
 	else
 	  gcc_unreachable ();
 
-	gnu_result = convert (gnu_result_type, gnu_result);
+	gnu_result = gnat_convert_internal (gnu_result_type, gnu_result);
       }
       break;
 
@@ -3360,7 +3360,7 @@
 	  {
 	    tree gnu_count_type = get_base_type (TREE_TYPE (gnu_rhs));
 	    tree gnu_max_shift
-	      = convert (gnu_count_type, TYPE_SIZE (gnu_type));
+	      = gnat_convert_internal (gnu_count_type, TYPE_SIZE (gnu_type));
 
 	    if (Nkind (gnat_node) == N_Op_Rotate_Left
 		|| Nkind (gnat_node) == N_Op_Rotate_Right)
@@ -3373,7 +3373,7 @@
 		   build_binary_op (MINUS_EXPR,
 				    gnu_count_type,
 				    gnu_max_shift,
-				    convert (gnu_count_type,
+				    gnat_convert_internal (gnu_count_type,
 					     integer_one_node)),
 		   gnu_rhs);
 	  }
@@ -3389,8 +3389,8 @@
 
 	if (gnu_type != gnu_result_type)
 	  {
-	    gnu_lhs = convert (gnu_type, gnu_lhs);
-	    gnu_rhs = convert (gnu_type, gnu_rhs);
+	    gnu_lhs = gnat_convert_internal (gnu_type, gnu_lhs);
+	    gnu_rhs = gnat_convert_internal (gnu_type, gnu_rhs);
 	  }
 
 	gnu_result = build_binary_op (code, gnu_type, gnu_lhs, gnu_rhs);
@@ -3406,9 +3406,9 @@
 	      (gnu_type,
 	       build_binary_op (GE_EXPR, integer_type_node,
 				gnu_rhs,
-				convert (TREE_TYPE (gnu_rhs),
+				gnat_convert_internal (TREE_TYPE (gnu_rhs),
 					 TYPE_SIZE (gnu_type))),
-	       convert (gnu_type, integer_zero_node),
+	       gnat_convert_internal (gnu_type, integer_zero_node),
 	       gnu_result);
       }
       break;
@@ -3491,7 +3491,7 @@
 		|| Is_Constrained (gnat_desig_type))
 	      {
 		gnu_type = gnat_to_gnu_type (gnat_desig_type);
-		gnu_init = convert (gnu_type, gnu_init);
+		gnu_init = gnat_convert_internal (gnu_type, gnu_init);
 	      }
 	    else
 	      {
@@ -3499,7 +3499,7 @@
 		if (TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE)
 		  gnu_type = TREE_TYPE (gnu_init);
 
-		gnu_init = convert (gnu_type, gnu_init);
+		gnu_init = gnat_convert_internal (gnu_type, gnu_init);
 	      }
 	  }
 	else
@@ -4057,7 +4057,7 @@
 	     by converting to a thin pointer.  */
 	  if (TYPE_FAT_POINTER_P (TREE_TYPE (gnu_ptr)))
 	    gnu_ptr
-	      = convert (build_pointer_type
+	      = gnat_convert_internal (build_pointer_type
 			 (TYPE_OBJECT_RECORD_TYPE
 			  (TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (gnu_ptr)))),
 			 gnu_ptr);
@@ -4087,10 +4087,10 @@
 	      tree gnu_char_ptr_type = build_pointer_type (char_type_node);
 	      tree gnu_pos = byte_position (TYPE_FIELDS (gnu_obj_type));
 	      tree gnu_byte_offset
-		= convert (gnu_char_ptr_type,
+		= gnat_convert_internal (gnu_char_ptr_type,
 			   size_diffop (size_zero_node, gnu_pos));
 
-	      gnu_ptr = convert (gnu_char_ptr_type, gnu_ptr);
+	      gnu_ptr = gnat_convert_internal (gnu_char_ptr_type, gnu_ptr);
 	      gnu_ptr = build_binary_op (MINUS_EXPR, gnu_char_ptr_type,
 					 gnu_ptr, gnu_byte_offset);
 	    }
@@ -4288,7 +4288,7 @@
 	  && CONTAINS_PLACEHOLDER_P (TYPE_SIZE
 				     (TREE_TYPE (TYPE_FIELDS
 						 (TREE_TYPE (gnu_result))))))
-	gnu_result = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))),
+	gnu_result = gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))),
 			      gnu_result);
     }
 
@@ -4310,7 +4310,7 @@
       /* Remove any padding record, but do nothing more in this case.  */
       if (TREE_CODE (TREE_TYPE (gnu_result)) == RECORD_TYPE
 	  && TYPE_IS_PADDING_P (TREE_TYPE (gnu_result)))
-	gnu_result = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))),
+	gnu_result = gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))),
 			      gnu_result);
     }
 
@@ -4318,7 +4318,7 @@
 	   || gnu_result_type == void_type_node)
     gnu_result =  error_mark_node;
   else if (gnu_result_type != TREE_TYPE (gnu_result))
-    gnu_result = convert (gnu_result_type, gnu_result);
+    gnu_result = gnat_convert_internal (gnu_result_type, gnu_result);
 
   /* We don't need any NOP_EXPR or NON_LVALUE_EXPR on GNU_RESULT.  */
   while ((TREE_CODE (gnu_result) == NOP_EXPR
@@ -4440,7 +4440,7 @@
       if (TREE_CODE (TREE_TYPE (gnu_decl)) == RECORD_TYPE
 	  && TYPE_IS_PADDING_P (TREE_TYPE (gnu_decl)))
 	gnu_lhs
-	  = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_decl))), gnu_decl);
+	  = gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_decl))), gnu_decl);
 
       /* Otherwise, if this is going into memory and the initializer isn't
 	 valid for the assembler and loader.  Gimplification could do this,
@@ -4659,7 +4659,7 @@
 	 dereference it.  */
       if (AGGREGATE_TYPE_P (TREE_TYPE (expr)))
 	*expr_p = build1 (INDIRECT_REF, TREE_TYPE (expr),
-			  convert (build_pointer_type (TREE_TYPE (expr)),
+			  gnat_convert_internal (build_pointer_type (TREE_TYPE (expr)),
 				   integer_zero_node));
       else
 	{
@@ -5215,12 +5215,12 @@
     (build_binary_op (TRUTH_ORIF_EXPR, integer_type_node,
 		      invert_truthvalue
 		      (build_binary_op (GE_EXPR, integer_type_node,
-				       convert (gnu_compare_type, gnu_expr),
-				       convert (gnu_compare_type, gnu_low))),
+				       gnat_convert_internal (gnu_compare_type, gnu_expr),
+				       gnat_convert_internal (gnu_compare_type, gnu_low))),
 		      invert_truthvalue
 		      (build_binary_op (LE_EXPR, integer_type_node,
-					convert (gnu_compare_type, gnu_expr),
-					convert (gnu_compare_type,
+					gnat_convert_internal (gnu_compare_type, gnu_expr),
+					gnat_convert_internal (gnu_compare_type,
 						 gnu_high)))),
      gnu_expr, CE_Range_Check_Failed);
 }
@@ -5250,7 +5250,7 @@
 
   /* Must do this computation in the base type in case the expression's
      type is an unsigned subtypes.  */
-  gnu_expr_check = convert (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr);
+  gnu_expr_check = gnat_convert_internal (get_base_type (TREE_TYPE (gnu_expr)), gnu_expr);
 
   /* If GNU_LOW or GNU_HIGH are a PLACEHOLDER_EXPR, qualify them by
      the object we are handling. */
@@ -5263,11 +5263,11 @@
     (build_binary_op (TRUTH_ORIF_EXPR, integer_type_node,
 		      build_binary_op (LT_EXPR, integer_type_node,
 				       gnu_expr_check,
-				       convert (TREE_TYPE (gnu_expr_check),
+				       gnat_convert_internal (TREE_TYPE (gnu_expr_check),
 						gnu_low)),
 		      build_binary_op (GT_EXPR, integer_type_node,
 				       gnu_expr_check,
-				       convert (TREE_TYPE (gnu_expr_check),
+				       gnat_convert_internal (TREE_TYPE (gnu_expr_check),
 						gnu_high))),
      gnu_expr, CE_Index_Check_Failed);
 }
@@ -5331,7 +5331,7 @@
      and simplifies code in all cases anyway.   */
   if (!rangep && !overflowp && INTEGRAL_TYPE_P (gnu_base_type)
       && !FLOAT_TYPE_P (gnu_in_type))
-    return convert (gnu_type, gnu_expr);
+    return gnat_convert_internal (gnu_type, gnu_expr);
 
   /* First convert the expression to its base type.  This
      will never generate code, but makes the tests below much simpler.
@@ -5339,7 +5339,7 @@
      array type since then we need to get the bounds from the original
      (unpacked) type.  */
   if (TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE)
-    gnu_result = convert (gnu_in_basetype, gnu_result);
+    gnu_result = gnat_convert_internal (gnu_in_basetype, gnu_result);
 
   /* If overflow checks are requested,  we need to be sure the result will
      fit in the output base type.  But don't do this if the input
@@ -5359,17 +5359,17 @@
 	 comparing them properly.  Likewise, convert the upper bounds
 	 to unsigned types.  */
       if (INTEGRAL_TYPE_P (gnu_in_basetype) && TYPE_UNSIGNED (gnu_in_basetype))
-	gnu_in_lb = convert (gnat_signed_type (gnu_in_basetype), gnu_in_lb);
+	gnu_in_lb = gnat_convert_internal (gnat_signed_type (gnu_in_basetype), gnu_in_lb);
 
       if (INTEGRAL_TYPE_P (gnu_in_basetype)
 	  && !TYPE_UNSIGNED (gnu_in_basetype))
-	gnu_in_ub = convert (gnat_unsigned_type (gnu_in_basetype), gnu_in_ub);
+	gnu_in_ub = gnat_convert_internal (gnat_unsigned_type (gnu_in_basetype), gnu_in_ub);
 
       if (INTEGRAL_TYPE_P (gnu_base_type) && TYPE_UNSIGNED (gnu_base_type))
-	gnu_out_lb = convert (gnat_signed_type (gnu_base_type), gnu_out_lb);
+	gnu_out_lb = gnat_convert_internal (gnat_signed_type (gnu_base_type), gnu_out_lb);
 
       if (INTEGRAL_TYPE_P (gnu_base_type) && !TYPE_UNSIGNED (gnu_base_type))
-	gnu_out_ub = convert (gnat_unsigned_type (gnu_base_type), gnu_out_ub);
+	gnu_out_ub = gnat_convert_internal (gnat_unsigned_type (gnu_base_type), gnu_out_ub);
 
       /* Check each bound separately and only if the result bound
 	 is tighter than the bound on the input type.  Note that all the
@@ -5390,7 +5390,7 @@
 	gnu_cond
 	  = invert_truthvalue
 	    (build_binary_op (GE_EXPR, integer_type_node,
-			      gnu_input, convert (gnu_in_basetype,
+			      gnu_input, gnat_convert_internal (gnu_in_basetype,
 						  gnu_out_lb)));
 
       if (INTEGRAL_TYPE_P (gnu_in_basetype)
@@ -5404,7 +5404,7 @@
 			     invert_truthvalue
 			     (build_binary_op (LE_EXPR, integer_type_node,
 					       gnu_input,
-					       convert (gnu_in_basetype,
+					       gnat_convert_internal (gnu_in_basetype,
 							gnu_out_ub))));
 
       if (!integer_zerop (gnu_cond))
@@ -5460,9 +5460,9 @@
          conversion of the input to the calc_type (if necessary).
       */
 
-      gnu_zero = convert (gnu_in_basetype, integer_zero_node);
+      gnu_zero = gnat_convert_internal (gnu_in_basetype, integer_zero_node);
       gnu_saved_result = save_expr (gnu_result);
-      gnu_conv = convert (calc_type, gnu_saved_result);
+      gnu_conv = gnat_convert_internal (calc_type, gnu_saved_result);
       gnu_comp = build2 (GE_EXPR, integer_type_node,
 	                gnu_saved_result, gnu_zero);
       gnu_add_pred_half
@@ -5478,7 +5478,7 @@
       && TREE_CODE (gnu_result) == UNCONSTRAINED_ARRAY_REF)
     gnu_result = unchecked_convert (gnu_base_type, gnu_result, false);
   else
-    gnu_result = convert (gnu_base_type, gnu_result);
+    gnu_result = gnat_convert_internal (gnu_base_type, gnu_result);
 
   /* Finally, do the range check if requested.  Note that if the
      result type is a modular type, the range check is actually
@@ -5489,7 +5489,7 @@
 	  && TYPE_MODULAR_P (gnu_base_type) && overflowp))
     gnu_result = emit_range_check (gnu_result, gnat_type);
 
-  return convert (gnu_type, gnu_result);
+  return gnat_convert_internal (gnu_type, gnu_result);
 }
 
 /* Return 1 if GNU_EXPR can be directly addressed.  This is the case unless
@@ -5695,7 +5695,7 @@
       if (Do_Range_Check (Expression (gnat_assoc)))
 	gnu_expr = emit_range_check (gnu_expr, Etype (gnat_field));
 
-      gnu_expr = convert (TREE_TYPE (gnu_field), gnu_expr);
+      gnu_expr = gnat_convert_internal (TREE_TYPE (gnu_field), gnu_expr);
 
       /* Add the field and expression to the list.  */
       gnu_list = tree_cons (gnu_field, gnu_expr, gnu_list);
@@ -5753,7 +5753,7 @@
 	}
 
       gnu_expr_list
-	= tree_cons (gnu_index, convert (TREE_TYPE (gnu_array_type), gnu_expr),
+	= tree_cons (gnu_index, gnat_convert_internal (TREE_TYPE (gnu_array_type), gnu_expr),
 		     gnu_expr_list);
 
       gnu_index = int_const_binop (PLUS_EXPR, gnu_index, integer_one_node, 0);
@@ -5798,7 +5798,7 @@
 	for (tem = values; tem; tem = TREE_CHAIN (tem))
 	  if (DECL_NAME (TREE_PURPOSE (tem)) == DECL_NAME (field))
 	    {
-	      value = convert (TREE_TYPE (field), TREE_VALUE (tem));
+	      value = gnat_convert_internal (TREE_TYPE (field), TREE_VALUE (tem));
 	      TREE_ADDRESSABLE (tem) = 1;
 	    }
 
@@ -5825,7 +5825,7 @@
   /* If we got a padded type, remove it too.  */
   if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
       && TYPE_IS_PADDING_P (TREE_TYPE (exp)))
-    exp = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (exp))), exp);
+    exp = gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (exp))), exp);
 
   return exp;
 }
Index: gcc/ada/utils.c
===================================================================
--- gcc/ada/utils.c	(revision 111978)
+++ gcc/ada/utils.c	(working copy)
@@ -803,7 +803,7 @@
     {
       tree size_unit
 	= (had_size_unit ? TYPE_SIZE_UNIT (record_type)
-	   : convert (sizetype, size_binop (CEIL_DIV_EXPR, size,
+	   :gnat_convert_internal (sizetype, size_binop (CEIL_DIV_EXPR, size,
 					    bitsize_unit_node)));
 
       TYPE_SIZE (record_type)
@@ -1069,12 +1069,12 @@
      the effort.  */
   STRIP_NOPS (in);
 
-  *pvar = convert (bitsizetype, in);
+  *pvar =gnat_convert_internal (bitsizetype, in);
 
   if (TREE_CODE (in) == INTEGER_CST)
     {
       *pvar = bitsize_zero_node;
-      return convert (bitsizetype, in);
+      return gnat_convert_internal (bitsizetype, in);
     }
   else if (TREE_CODE (in) == PLUS_EXPR || TREE_CODE (in) == MINUS_EXPR)
     {
@@ -1361,7 +1361,7 @@
      creation below, which is typically required when no position has been
      specified.  */
   if (size)
-    size = convert (bitsizetype, size);
+    size =gnat_convert_internal (bitsizetype, size);
   else if (packed == 1)
     {
       size = rm_size (field_type);
@@ -2119,8 +2119,8 @@
       else
 	gcc_unreachable ();
 
-      min = convert (TREE_TYPE (TREE_CHAIN (field)), TYPE_MIN_VALUE (bounds));
-      max = convert (TREE_TYPE (field), TYPE_MAX_VALUE (bounds));
+      min =gnat_convert_internal (TREE_TYPE (TREE_CHAIN (field)), TYPE_MIN_VALUE (bounds));
+      max =gnat_convert_internal (TREE_TYPE (field), TYPE_MAX_VALUE (bounds));
 
       /* If either MIN or MAX involve a PLACEHOLDER_EXPR, we must
 	 substitute it from OBJECT.  */
@@ -2358,7 +2358,7 @@
       for (i = 0, inner_type = type; i < ndim;
 	   i++, inner_type = TREE_TYPE (inner_type))
 	tem = build4 (ARRAY_REF, TREE_TYPE (inner_type), tem,
-		      convert (TYPE_DOMAIN (inner_type), size_zero_node),
+		     gnat_convert_internal (TYPE_DOMAIN (inner_type), size_zero_node),
 		      NULL_TREE, NULL_TREE);
 
       field_list
@@ -2647,9 +2647,9 @@
       gnat_build_constructor
 	(type,
 	 tree_cons (TYPE_FIELDS (type),
-		    convert (TREE_TYPE (TYPE_FIELDS (type)), expr),
+		   gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (type)), expr),
 		    tree_cons (TREE_CHAIN (TYPE_FIELDS (type)),
-			       convert (build_pointer_type (template_type),
+			      gnat_convert_internal (build_pointer_type (template_type),
 					expr),
 			       NULL_TREE)));
 
@@ -2691,7 +2691,7 @@
    return
      gnat_build_constructor
      (type, tree_cons (TYPE_FIELDS (type),
- 		      convert (TREE_TYPE (TYPE_FIELDS (type)), expr),
+ 		     gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (type)), expr),
  		      tree_cons (TREE_CHAIN (TYPE_FIELDS (type)),
  				 template_addr, NULL_TREE)));
 }
@@ -2723,8 +2723,9 @@
    conversions; callers should filter out those that are
    not permitted by the language being compiled.  */
 
+
 tree
-convert (tree type, tree expr)
+gnat_convert_internal (tree type, tree expr)
 {
   enum tree_code code = TREE_CODE (type);
   tree etype = TREE_TYPE (expr);
@@ -2753,7 +2754,7 @@
 	     == TYPE_FIELDS (etype))
 	return VEC_index (constructor_elt, CONSTRUCTOR_ELTS (expr), 0)->value;
       else
-	return convert (type,
+	return gnat_convert_internal (type,
 			build_component_ref (expr, NULL_TREE,
 					     TYPE_FIELDS (etype), false));
     }
@@ -2773,7 +2774,7 @@
 	  && TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == RECORD_TYPE
 	  && TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (expr, 0)))
 	  && !TREE_CONSTANT (TYPE_SIZE (type)))
-	return convert (type, TREE_OPERAND (expr, 0));
+	return gnat_convert_internal (type, TREE_OPERAND (expr, 0));
 
       /* If the result type is a padded type with a self-referentially-sized
 	 field and the expression type is a record, do this as an
@@ -2786,7 +2787,7 @@
 	return
 	  gnat_build_constructor (type,
 			     tree_cons (TYPE_FIELDS (type),
-					convert (TREE_TYPE
+					gnat_convert_internal (TREE_TYPE
 						 (TYPE_FIELDS (type)),
 						 expr),
 					NULL_TREE));
@@ -2794,7 +2795,7 @@
 
   /* If the input is a biased type, adjust first.  */
   if (ecode == INTEGER_TYPE && TYPE_BIASED_REPRESENTATION_P (etype))
-    return convert (type, fold (build2 (PLUS_EXPR, TREE_TYPE (etype),
+    return gnat_convert_internal (type, fold (build2 (PLUS_EXPR, TREE_TYPE (etype),
 					fold_convert (TREE_TYPE (etype),
 						      expr),
 					TYPE_MIN_VALUE (etype))));
@@ -2808,7 +2809,7 @@
   if (ecode == RECORD_TYPE && TYPE_JUSTIFIED_MODULAR_P (etype)
       && code != UNCONSTRAINED_ARRAY_TYPE
       && TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (etype))
-    return convert (type, build_component_ref (expr, NULL_TREE,
+    return gnat_convert_internal (type, build_component_ref (expr, NULL_TREE,
 					       TYPE_FIELDS (etype), false));
 
   /* If converting to a type that contains a template, convert to the data
@@ -2829,7 +2830,7 @@
 		      build_template (TREE_TYPE (TYPE_FIELDS (type)),
 				      obj_type, NULL_TREE),
 		      tree_cons (TREE_CHAIN (TYPE_FIELDS (type)),
-				 convert (obj_type, expr), NULL_TREE)));
+				gnat_convert_internal (obj_type, expr), NULL_TREE)));
     }
 
   /* There are some special cases of expressions that we process
@@ -2901,7 +2902,7 @@
 	       one of the types is a fat pointer,  which is handled by
 	       specialized code below which relies on exact type matching.  */
 	    else if (!TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype))
-	      return convert (type, op0);
+	      return gnat_convert_internal (type, op0);
 	  }
       }
       break;
@@ -2921,7 +2922,7 @@
 	      || TREE_CODE (etype) == UNION_TYPE)
 	  && !TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype))
 	return build_unary_op (INDIRECT_REF, NULL_TREE,
-			       convert (build_pointer_type (type),
+			      gnat_convert_internal (build_pointer_type (type),
 					TREE_OPERAND (expr, 0)));
       break;
 
@@ -2961,7 +2962,7 @@
       else if (TYPE_BIASED_REPRESENTATION_P (type))
 	return fold_convert (type,
 			     fold_build2 (MINUS_EXPR, TREE_TYPE (type),
-					  convert (TREE_TYPE (type), expr),
+					 gnat_convert_internal (TREE_TYPE (type), expr),
 					  TYPE_MIN_VALUE (type)));
 
       /* ... fall through ... */
@@ -3012,7 +3013,7 @@
 	return
 	  gnat_build_constructor
 	    (type, tree_cons (TYPE_FIELDS (type),
-			      convert (TREE_TYPE (TYPE_FIELDS (type)), expr),
+			     gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (type)), expr),
 			      NULL_TREE));
 
       /* ... fall through ... */
@@ -3051,7 +3052,7 @@
       else if (ecode == UNCONSTRAINED_ARRAY_TYPE)
 	return
 	  build_unary_op (INDIRECT_REF, NULL_TREE,
-			  convert (TREE_TYPE (type),
+			 gnat_convert_internal (TREE_TYPE (type),
 				   build_unary_op (ADDR_EXPR,
 						   NULL_TREE, expr)));
       else
@@ -3064,6 +3065,7 @@
       gcc_unreachable ();
     }
 }
+
 
 /* Remove all conversions that are done in EXP.  This includes converting
    from a padded type or to a justified modular type.  If TRUE_ADDRESS
@@ -3137,7 +3139,7 @@
 	 it contains a template.  */
       if (TYPE_IS_PADDING_P (TREE_TYPE (exp)))
 	{
-	  new = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (exp))), exp);
+	  new =gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (exp))), exp);
 	  if (TREE_CODE (TREE_TYPE (new)) == RECORD_TYPE
 	      && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (new)))
 	    return
@@ -3206,7 +3208,7 @@
 	  TYPE_MAIN_VARIANT (rtype) = rtype;
 	}
 
-      expr = convert (rtype, expr);
+      expr =gnat_convert_internal (rtype, expr);
       if (type != rtype)
 	expr = build1 (NOP_EXPR, type, expr);
     }
@@ -3290,16 +3292,16 @@
       tree base_type = gnat_type_for_mode (TYPE_MODE (type),
 					   TYPE_UNSIGNED (type));
       tree shift_expr
-	= convert (base_type,
+	=gnat_convert_internal (base_type,
 		   size_binop (MINUS_EXPR,
 			       bitsize_int
 			       (GET_MODE_BITSIZE (TYPE_MODE (type))),
 			       TYPE_RM_SIZE (type)));
       expr
-	= convert (type,
+	=gnat_convert_internal (type,
 		   build_binary_op (RSHIFT_EXPR, base_type,
 				    build_binary_op (LSHIFT_EXPR, base_type,
-						     convert (base_type, expr),
+						    gnat_convert_internal (base_type, expr),
 						     shift_expr),
 				    shift_expr));
     }
Index: gcc/ada/decl.c
===================================================================
--- gcc/ada/decl.c	(revision 111978)
+++ gcc/ada/decl.c	(working copy)
@@ -721,7 +721,7 @@
 		 && TYPE_IS_PADDING_P (gnu_type)
 		 && (CONTAINS_PLACEHOLDER_P
 		     (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (gnu_type)))))))
-	  gnu_expr = convert (gnu_type, gnu_expr);
+	  gnu_expr = gnat_convert_internal (gnu_type, gnu_expr);
 
 	/* See if this is a renaming, and handle appropriately depending on
 	   what is renamed and in which context.  There are three major
@@ -930,7 +930,7 @@
 	       above.  */
 	    gnu_size = NULL_TREE;
 	    gnu_type = build_reference_type (gnu_type);
-	    gnu_address = convert (gnu_type, gnu_address);
+	    gnu_address = gnat_convert_internal (gnu_type, gnu_address);
 	    used_by_ref = true;
 	    const_flag = !Is_Public (gnat_entity);
 
@@ -1099,7 +1099,7 @@
 		 && TYPE_IS_PADDING_P (gnu_type)
 		 && (CONTAINS_PLACEHOLDER_P
 		     (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (gnu_type)))))))
-	  gnu_expr = convert (gnu_type, gnu_expr);
+	  gnu_expr = gnat_convert_internal (gnu_type, gnu_expr);
 
 	/* If this name is external or there was a name specified, use it,
 	   unless this is a VMS exception object since this would conflict
@@ -1310,7 +1310,7 @@
 	    TYPE_MODULAR_P (gnu_type) = 1;
 	    SET_TYPE_MODULUS (gnu_type, gnu_modulus);
 	    gnu_high = fold (build2 (MINUS_EXPR, gnu_type, gnu_modulus,
-				     convert (gnu_type, integer_one_node)));
+				     gnat_convert_internal (gnu_type, integer_one_node)));
 	  }
 
 	/* If we have to set TYPE_PRECISION different from its natural value,
@@ -1380,14 +1380,14 @@
       TREE_TYPE (gnu_type) = get_unpadded_type (Etype (gnat_entity));
 
       TYPE_MIN_VALUE (gnu_type)
-	= convert (TREE_TYPE (gnu_type),
+	= gnat_convert_internal (TREE_TYPE (gnu_type),
 		   elaborate_expression (Type_Low_Bound (gnat_entity),
 					 gnat_entity,
 					 get_identifier ("L"), definition, 1,
 					 Needs_Debug_Info (gnat_entity)));
 
       TYPE_MAX_VALUE (gnu_type)
-	= convert (TREE_TYPE (gnu_type),
+	= gnat_convert_internal (TREE_TYPE (gnu_type),
 		   elaborate_expression (Type_High_Bound (gnat_entity),
 					 gnat_entity,
 					 get_identifier ("U"), definition, 1,
@@ -1501,14 +1501,14 @@
 	TYPE_PRECISION (gnu_type) = fp_size_to_prec (esize);
 
 	TYPE_MIN_VALUE (gnu_type)
-	  = convert (TREE_TYPE (gnu_type),
+	  = gnat_convert_internal (TREE_TYPE (gnu_type),
 		     elaborate_expression (Type_Low_Bound (gnat_entity),
 					   gnat_entity, get_identifier ("L"),
 					   definition, 1,
 					   Needs_Debug_Info (gnat_entity)));
 
 	TYPE_MAX_VALUE (gnu_type)
-	  = convert (TREE_TYPE (gnu_type),
+	  = gnat_convert_internal (TREE_TYPE (gnu_type),
 		     elaborate_expression (Type_High_Bound (gnat_entity),
 					   gnat_entity, get_identifier ("U"),
 					   definition, 1,
@@ -1620,9 +1620,9 @@
 	    tree gnu_base_subtype
 	      = get_unpadded_type (Etype (gnat_ind_base_subtype));
 	    tree gnu_base_min
-	      = convert (sizetype, TYPE_MIN_VALUE (gnu_base_subtype));
+	      = gnat_convert_internal (sizetype, TYPE_MIN_VALUE (gnu_base_subtype));
 	    tree gnu_base_max
-	      = convert (sizetype, TYPE_MAX_VALUE (gnu_base_subtype));
+	      = gnat_convert_internal (sizetype, TYPE_MAX_VALUE (gnu_base_subtype));
 	    tree gnu_min_field, gnu_max_field, gnu_min, gnu_max;
 
 	    /* Make the FIELD_DECLs for the minimum and maximum of this
@@ -1656,8 +1656,8 @@
 	    /* Make a range type with the new ranges, but using
 	       the Ada subtype.  Then we convert to sizetype.  */
 	    gnu_index_types[index]
-	      = create_index_type (convert (sizetype, gnu_min),
-				   convert (sizetype, gnu_max),
+	      = create_index_type (gnat_convert_internal (sizetype, gnu_min),
+				   gnat_convert_internal (sizetype, gnu_max),
 				   build_range_type (gnu_ind_subtype,
 						     gnu_min, gnu_max));
 	    /* Update the maximum size of the array, in elements. */
@@ -1724,7 +1724,7 @@
 						    TYPE_SIZE_UNIT (tem)));
 	gnu_max_size = size_binop (MAX_EXPR, bitsize_zero_node,
 				   size_binop (MULT_EXPR,
-					       convert (bitsizetype,
+					       gnat_convert_internal (bitsizetype,
 							gnu_max_size),
 					       TYPE_SIZE (tem)));
 
@@ -1859,20 +1859,20 @@
 	      tree gnu_index_subtype
 		= get_unpadded_type (Etype (gnat_ind_subtype));
 	      tree gnu_min
-		= convert (sizetype, TYPE_MIN_VALUE (gnu_index_subtype));
+		= gnat_convert_internal (sizetype, TYPE_MIN_VALUE (gnu_index_subtype));
 	      tree gnu_max
-		= convert (sizetype, TYPE_MAX_VALUE (gnu_index_subtype));
+		= gnat_convert_internal (sizetype, TYPE_MAX_VALUE (gnu_index_subtype));
 	      tree gnu_base_subtype
 		= get_unpadded_type (Etype (gnat_ind_base_subtype));
 	      tree gnu_base_min
-		= convert (sizetype, TYPE_MIN_VALUE (gnu_base_subtype));
+		= gnat_convert_internal (sizetype, TYPE_MIN_VALUE (gnu_base_subtype));
 	      tree gnu_base_max
-		= convert (sizetype, TYPE_MAX_VALUE (gnu_base_subtype));
+		= gnat_convert_internal (sizetype, TYPE_MAX_VALUE (gnu_base_subtype));
 	      tree gnu_base_type = get_base_type (gnu_base_subtype);
 	      tree gnu_base_base_min
-		= convert (sizetype, TYPE_MIN_VALUE (gnu_base_type));
+		= gnat_convert_internal (sizetype, TYPE_MIN_VALUE (gnu_base_type));
 	      tree gnu_base_base_max
-		= convert (sizetype, TYPE_MAX_VALUE (gnu_base_type));
+		= gnat_convert_internal (sizetype, TYPE_MAX_VALUE (gnu_base_type));
 	      tree gnu_high;
 	      tree gnu_this_max;
 
@@ -2046,7 +2046,7 @@
 	  gnu_max_size_unit = size_binop (MULT_EXPR, gnu_max_size,
 					  TYPE_SIZE_UNIT (gnu_type));
 	  gnu_max_size = size_binop (MULT_EXPR,
-				     convert (bitsizetype, gnu_max_size),
+				     gnat_convert_internal (bitsizetype, gnu_max_size),
 				     TYPE_SIZE (gnu_type));
 
 	  for (index = array_dim - 1; index >= 0; index --)
@@ -2275,21 +2275,21 @@
 	  = get_base_type (TREE_TYPE (TYPE_INDEX_TYPE
 				      (TYPE_DOMAIN (gnu_string_array_type))));
 	tree gnu_lower_bound
-	  = convert (gnu_string_index_type,
+	  = gnat_convert_internal (gnu_string_index_type,
 		     gnat_to_gnu (String_Literal_Low_Bound (gnat_entity)));
 	int length = UI_To_Int (String_Literal_Length (gnat_entity));
 	tree gnu_length = ssize_int (length - 1);
 	tree gnu_upper_bound
 	  = build_binary_op (PLUS_EXPR, gnu_string_index_type,
 			     gnu_lower_bound,
-			     convert (gnu_string_index_type, gnu_length));
+			     gnat_convert_internal (gnu_string_index_type, gnu_length));
 	tree gnu_range_type
 	  = build_range_type (gnu_string_index_type,
 			      gnu_lower_bound, gnu_upper_bound);
 	tree gnu_index_type
-	  = create_index_type (convert (sizetype,
+	  = create_index_type (gnat_convert_internal (sizetype,
 					TYPE_MIN_VALUE (gnu_range_type)),
-			       convert (sizetype,
+			       gnat_convert_internal (sizetype,
 					TYPE_MAX_VALUE (gnu_range_type)),
 			       gnu_range_type);
 
@@ -2743,7 +2743,7 @@
 			SET_DECL_OFFSET_ALIGN (gnu_field, offset_align);
 			DECL_SIZE (gnu_field) = gnu_size;
 			DECL_SIZE_UNIT (gnu_field)
-			  = convert (sizetype,
+			  = gnat_convert_internal (sizetype,
 				     size_binop (CEIL_DIV_EXPR, gnu_size,
 						 bitsize_unit_node));
 			layout_decl (gnu_field, DECL_OFFSET_ALIGN (gnu_field));
@@ -3792,7 +3792,7 @@
 
 	    gnu_type = build_reference_type (gnu_type);
 	    if (gnu_address)
-	      gnu_address = convert (gnu_type, gnu_address);
+	      gnu_address = gnat_convert_internal (gnu_type, gnu_address);
 
 	    gnu_decl
 	      = create_var_decl (gnu_entity_id, gnu_ext_name, gnu_type,
@@ -4815,7 +4815,7 @@
 {
   tree record_type = make_node (RECORD_TYPE);
   tree place = build0 (PLACEHOLDER_EXPR, record_type);
-  tree size_addr_place = convert (sizetype,
+  tree size_addr_place = gnat_convert_internal (sizetype,
 				  build_unary_op (ADDR_EXPR, NULL_TREE,
 						  place));
   tree name = TYPE_NAME (type);
@@ -4830,7 +4830,7 @@
      with the two's complement of the address and  multiplying
      by the number of bits per unit.  Do all this in sizetype.  */
   pos = size_binop (MULT_EXPR,
-		    convert (bitsizetype,
+		    gnat_convert_internal (bitsizetype,
 			     size_binop (BIT_AND_EXPR,
 					 size_diffop (size_zero_node,
 						      size_addr_place),
@@ -4850,7 +4850,7 @@
   TYPE_ALIGN (record_type) = BIGGEST_ALIGNMENT;
   TYPE_SIZE (record_type)
     = size_binop (PLUS_EXPR,
-		  size_binop (MULT_EXPR, convert (bitsizetype, size),
+		  size_binop (MULT_EXPR, gnat_convert_internal (bitsizetype, size),
 			      bitsize_unit_node),
 		  bitsize_int (align));
   TYPE_SIZE_UNIT (record_type)
@@ -5036,7 +5036,7 @@
   DECL_INTERNAL_P (field) = 1;
   TYPE_SIZE (record) = size ? size : orig_size;
   TYPE_SIZE_UNIT (record)
-    = (size ? convert (sizetype,
+    = (size ? gnat_convert_internal (sizetype,
 		       size_binop (CEIL_DIV_EXPR, size, bitsize_unit_node))
        : TYPE_SIZE_UNIT (type));
 
@@ -5865,7 +5865,7 @@
 
       /* This may have come from a conversion from some smaller type,
 	 so ensure this is in bitsizetype.  */
-      gnu_size = convert (bitsizetype, gnu_size);
+      gnu_size = gnat_convert_internal (bitsizetype, gnu_size);
 
       /* For negative values, use NEGATE_EXPR of the supplied value.  */
       if (tree_int_cst_sgn (gnu_size) < 0)
@@ -6326,9 +6326,9 @@
 	= unsigned_p ? make_unsigned_type (size) : make_signed_type (size);
       TREE_TYPE (new_type) = TREE_TYPE (type) ? TREE_TYPE (type) : type;
       TYPE_MIN_VALUE (new_type)
-	= convert (TREE_TYPE (new_type), TYPE_MIN_VALUE (type));
+	= gnat_convert_internal (TREE_TYPE (new_type), TYPE_MIN_VALUE (type));
       TYPE_MAX_VALUE (new_type)
-	= convert (TREE_TYPE (new_type), TYPE_MAX_VALUE (type));
+	= gnat_convert_internal (TREE_TYPE (new_type), TYPE_MAX_VALUE (type));
       TYPE_BIASED_REPRESENTATION_P (new_type) = biased_p;
       TYPE_RM_SIZE_NUM (new_type) = bitsize_int (size);
       return new_type;
Index: gcc/ada/utils2.c
===================================================================
--- gcc/ada/utils2.c	(revision 111978)
+++ gcc/ada/utils2.c	(working copy)
@@ -87,12 +87,12 @@
       return expr;
 
     case INTEGER_CST:
-      return (integer_zerop (expr) ? convert (type, integer_zero_node)
-	      : convert (type, integer_one_node));
+      return (integer_zerop (expr) ? gnat_convert_internal (type, integer_zero_node)
+	      : gnat_convert_internal (type, integer_one_node));
 
     case REAL_CST:
-      return (real_zerop (expr) ? convert (type, integer_zero_node)
-	      : convert (type, integer_one_node));
+      return (real_zerop (expr) ? gnat_convert_internal (type, integer_zero_node)
+	      : gnat_convert_internal (type, integer_one_node));
 
     case COND_EXPR:
       /* Distribute the conversion into the arms of a COND_EXPR.  */
@@ -103,7 +103,7 @@
 
     default:
       return build_binary_op (NE_EXPR, type, expr,
-			      convert (type, integer_zero_node));
+			      gnat_convert_internal (type, integer_zero_node));
     }
 }
 
@@ -336,9 +336,9 @@
 {
   tree t1 = TREE_TYPE (a1);
   tree t2 = TREE_TYPE (a2);
-  tree result = convert (result_type, integer_one_node);
-  tree a1_is_null = convert (result_type, integer_zero_node);
-  tree a2_is_null = convert (result_type, integer_zero_node);
+  tree result = gnat_convert_internal (result_type, integer_one_node);
+  tree a1_is_null = gnat_convert_internal (result_type, integer_zero_node);
+  tree a2_is_null = gnat_convert_internal (result_type, integer_zero_node);
   bool length_zero_p = false;
 
   /* Process each dimension separately and compare the lengths.  If any
@@ -362,7 +362,7 @@
 	 Note that we have set the `length' values to the length - 1.  */
       if (TREE_CODE (length1) == INTEGER_CST
 	  && !integer_zerop (fold (build2 (PLUS_EXPR, bt, length2,
-					   convert (bt, integer_one_node)))))
+					   gnat_convert_internal (bt, integer_one_node)))))
 	{
 	  tem = a1, a1 = a2, a2 = tem;
 	  tem = t1, t1 = t2, t2 = tem;
@@ -376,7 +376,7 @@
 	 zero, we can just go inside the original bounds for the first
 	 array and see if last < first.  */
       if (integer_zerop (fold (build2 (PLUS_EXPR, bt, length2,
-				       convert (bt, integer_one_node)))))
+				       gnat_convert_internal (bt, integer_one_node)))))
 	{
 	  tree ub = TYPE_MAX_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1)));
 	  tree lb = TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1)));
@@ -387,7 +387,7 @@
 
 	  length_zero_p = true;
 	  this_a1_is_null = comparison;
-	  this_a2_is_null = convert (result_type, integer_one_node);
+	  this_a2_is_null = gnat_convert_internal (result_type, integer_one_node);
 	}
 
       /* If the length is some other constant value, we know that the
@@ -413,7 +413,7 @@
 	  length1 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length1, a1);
 
 	  this_a1_is_null = build_binary_op (LT_EXPR, result_type, ub1, lb1);
-	  this_a2_is_null = convert (result_type, integer_zero_node);
+	  this_a2_is_null = gnat_convert_internal (result_type, integer_zero_node);
 	}
 
       /* Otherwise compare the computed lengths.  */
@@ -427,10 +427,10 @@
 
 	  this_a1_is_null
 	    = build_binary_op (LT_EXPR, result_type, length1,
-			       convert (bt, integer_zero_node));
+			       gnat_convert_internal (bt, integer_zero_node));
 	  this_a2_is_null
 	    = build_binary_op (LT_EXPR, result_type, length2,
-			       convert (bt, integer_zero_node));
+			       gnat_convert_internal (bt, integer_zero_node));
 	}
 
       result = build_binary_op (TRUTH_ANDIF_EXPR, result_type,
@@ -452,7 +452,7 @@
       tree type = find_common_type (TREE_TYPE (a1), TREE_TYPE (a2));
 
       if (type)
-	a1 = convert (type, a1), a2 = convert (type, a2);
+	a1 = gnat_convert_internal (type, a1), a2 = gnat_convert_internal (type, a2);
 
       result = build_binary_op (TRUTH_ANDIF_EXPR, result_type, result,
 				fold (build2 (EQ_EXPR, result_type, a1, a2)));
@@ -520,11 +520,11 @@
     {
       /* Copy the node so we ensure it can be modified to make it modular.  */
       op_type = copy_node (gnat_type_for_size (precision, unsignedp));
-      modulus = convert (op_type, modulus);
+      modulus = gnat_convert_internal (op_type, modulus);
       SET_TYPE_MODULUS (op_type, modulus);
       TYPE_MODULAR_P (op_type) = 1;
-      lhs = convert (op_type, lhs);
-      rhs = convert (op_type, rhs);
+      lhs = gnat_convert_internal (op_type, lhs);
+      rhs = gnat_convert_internal (op_type, rhs);
     }
 
   /* Do the operation, then we'll fix it up.  */
@@ -536,12 +536,12 @@
   if (op_code == MULT_EXPR)
     {
       tree div_type = copy_node (gnat_type_for_size (needed_precision, 1));
-      modulus = convert (div_type, modulus);
+      modulus = gnat_convert_internal (div_type, modulus);
       SET_TYPE_MODULUS (div_type, modulus);
       TYPE_MODULAR_P (div_type) = 1;
-      result = convert (op_type,
+      result = gnat_convert_internal (op_type,
 			fold (build2 (TRUNC_MOD_EXPR, div_type,
-				      convert (div_type, result), modulus)));
+				      gnat_convert_internal (div_type, result), modulus)));
     }
 
   /* For subtraction, add the modulus back if we are negative.  */
@@ -550,7 +550,7 @@
       result = save_expr (result);
       result = fold (build3 (COND_EXPR, op_type,
 			     build2 (LT_EXPR, integer_type_node, result,
-				     convert (op_type, integer_zero_node)),
+				     gnat_convert_internal (op_type, integer_zero_node)),
 			     fold (build2 (PLUS_EXPR, op_type,
 					   result, modulus)),
 			     result));
@@ -568,7 +568,7 @@
 			     result));
     }
 
-  return convert (type, result);
+  return gnat_convert_internal (type, result);
 }
 
 /* Make a binary operation of kind OP_CODE.  RESULT_TYPE is the type
@@ -710,7 +710,7 @@
       if (operation_type != right_type
 	  && (!CONTAINS_PLACEHOLDER_P (TYPE_SIZE (operation_type))))
 	{
-	  right_operand = convert (operation_type, right_operand);
+	  right_operand = gnat_convert_internal (operation_type, right_operand);
 	  right_type = operation_type;
 	}
 
@@ -734,8 +734,8 @@
       /* First convert the right operand to its base type.  This will
 	 prevent unneeded signedness conversions when sizetype is wider than
 	 integer.  */
-      right_operand = convert (right_base_type, right_operand);
-      right_operand = convert (TYPE_DOMAIN (left_type), right_operand);
+      right_operand = gnat_convert_internal (right_base_type, right_operand);
+      right_operand = gnat_convert_internal (TYPE_DOMAIN (left_type), right_operand);
 
       if (!TREE_CONSTANT (right_operand)
 	  || !TREE_CONSTANT (TYPE_MIN_VALUE (right_type)))
@@ -772,7 +772,7 @@
       if (TREE_CODE (left_type) == RECORD_TYPE
 	  && TYPE_JUSTIFIED_MODULAR_P (left_type))
 	{
-	  left_operand = convert (TREE_TYPE (TYPE_FIELDS (left_type)),
+	  left_operand = gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (left_type)),
 				  left_operand);
 	  left_type = TREE_TYPE (left_operand);
 	  left_base_type = get_base_type (left_type);
@@ -781,7 +781,7 @@
       if (TREE_CODE (right_type) == RECORD_TYPE
 	  && TYPE_JUSTIFIED_MODULAR_P (right_type))
 	{
-	  right_operand = convert (TREE_TYPE (TYPE_FIELDS (right_type)),
+	  right_operand = gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (right_type)),
 				  right_operand);
 	  right_type = TREE_TYPE (right_operand);
 	  right_base_type = get_base_type (right_type);
@@ -834,8 +834,8 @@
 	      else
 		gcc_unreachable ();
 
-	      left_operand = convert (best_type, left_operand);
-	      right_operand = convert (best_type, right_operand);
+	      left_operand = gnat_convert_internal (best_type, left_operand);
+	      right_operand = gnat_convert_internal (best_type, right_operand);
 	    }
 	  else
 	    gcc_unreachable ();
@@ -853,13 +853,13 @@
 	  right_operand = build_component_ref (left_operand, NULL_TREE,
 					       TYPE_FIELDS (left_base_type),
 					       false);
-	  left_operand = convert (TREE_TYPE (right_operand),
+	  left_operand = gnat_convert_internal (TREE_TYPE (right_operand),
 				  integer_zero_node);
 	}
       else
 	{
-	  left_operand = convert (left_base_type, left_operand);
-	  right_operand = convert (right_base_type, right_operand);
+	  left_operand = gnat_convert_internal (left_base_type, left_operand);
+	  right_operand = gnat_convert_internal (right_base_type, right_operand);
 	}
 
       modulus = NULL_TREE;
@@ -879,8 +879,8 @@
 
       gcc_assert (left_type == result_type);
       operation_type = get_base_type (result_type);
-      left_operand = convert (operation_type, left_operand);
-      right_operand = convert (operation_type, right_operand);
+      left_operand = gnat_convert_internal (operation_type, left_operand);
+      right_operand = gnat_convert_internal (operation_type, right_operand);
       has_side_effects = true;
       modulus = NULL_TREE;
       break;
@@ -894,7 +894,7 @@
 	 to modular types).  Otherwise, processing is the same as normal.  */
       gcc_assert (operation_type == left_base_type);
       modulus = NULL_TREE;
-      left_operand = convert (operation_type, left_operand);
+      left_operand = gnat_convert_internal (operation_type, left_operand);
       break;
 
     case TRUTH_ANDIF_EXPR:
@@ -919,8 +919,8 @@
     case COMPLEX_EXPR:
       gcc_assert (TREE_TYPE (result_type) == left_base_type
 		  && TREE_TYPE (result_type) == right_base_type);
-      left_operand = convert (left_base_type, left_operand);
-      right_operand = convert (right_base_type, right_operand);
+      left_operand = gnat_convert_internal (left_base_type, left_operand);
+      right_operand = gnat_convert_internal (right_base_type, right_operand);
       break;
 
     case TRUNC_DIV_EXPR:   case TRUNC_MOD_EXPR:
@@ -939,8 +939,8 @@
 
       gcc_assert (operation_type == left_base_type
 		  && left_base_type == right_base_type);
-      left_operand = convert (operation_type, left_operand);
-      right_operand = convert (operation_type, right_operand);
+      left_operand = gnat_convert_internal (operation_type, left_operand);
+      right_operand = gnat_convert_internal (operation_type, right_operand);
     }
 
   if (modulus && !integer_pow2p (modulus))
@@ -974,10 +974,10 @@
      if something above hasn't eliminated the need for it.  */
   if (modulus)
     result = fold (build2 (FLOOR_MOD_EXPR, operation_type, result,
-			   convert (operation_type, modulus)));
+			   gnat_convert_internal (operation_type, modulus)));
 
   if (result_type && result_type != operation_type)
-    result = convert (result_type, result);
+    result = gnat_convert_internal (result_type, result);
 
   return result;
 }
@@ -1066,7 +1066,7 @@
 		  && (CONTAINS_PLACEHOLDER_P
 		      (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS
 					     (TREE_TYPE (inner)))))))
-		inner = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (inner))),
+		inner = gnat_convert_internal (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (inner))),
 				 inner);
 
 	      /* Compute the offset as a byte offset from INNER.  */
@@ -1085,11 +1085,11 @@
 		 add then.  It will later be converted to the desired result
 		 type, if any.  */
 	      inner = build_unary_op (ADDR_EXPR, NULL_TREE, inner);
-	      inner = convert (ptr_void_type_node, inner);
-	      offset = convert (ptr_void_type_node, offset);
+	      inner = gnat_convert_internal (ptr_void_type_node, inner);
+	      offset = gnat_convert_internal (ptr_void_type_node, offset);
 	      result = build_binary_op (PLUS_EXPR, ptr_void_type_node,
 					inner, offset);
-	      result = convert (build_pointer_type (TREE_TYPE (operand)),
+	      result = gnat_convert_internal (build_pointer_type (TREE_TYPE (operand)),
 				result);
 	      break;
 	    }
@@ -1106,7 +1106,7 @@
 				   0)
 			->value);
 
-	      result = convert (build_pointer_type (TREE_TYPE (operand)),
+	      result = gnat_convert_internal (build_pointer_type (TREE_TYPE (operand)),
 				build_unary_op (ADDR_EXPR, NULL_TREE, result));
 	      break;
 	    }
@@ -1153,7 +1153,7 @@
 	      && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (TYPE_FIELDS (type))))
 	    {
 	      type = TREE_TYPE (TYPE_FIELDS (type));
-	      operand = convert (type, operand);
+	      operand = gnat_convert_internal (type, operand);
 	    }
 
 	  if (type != error_mark_node)
@@ -1175,7 +1175,7 @@
 	  && TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type)))
 	{
 	  operand
-	    = convert (TREE_TYPE (TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))),
+	    = gnat_convert_internal (TREE_TYPE (TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))),
 		       operand);
 	  type = TREE_TYPE (operand);
 	}
@@ -1216,7 +1216,7 @@
 	if (modulus)
 	  {
 	    gcc_assert (operation_type == base_type);
-	    operand = convert (operation_type, operand);
+	    operand = gnat_convert_internal (operation_type, operand);
 
 	    /* The fastest in the negate case for binary modulus is
 	       the straightforward code; the TRUNC_MOD_EXPR below
@@ -1235,7 +1235,7 @@
 	      {
 		if (integer_pow2p (fold (build2 (PLUS_EXPR, operation_type,
 						 modulus,
-						 convert (operation_type,
+						 gnat_convert_internal (operation_type,
 							  integer_one_node)))))
 		  result = fold (build2 (BIT_XOR_EXPR, operation_type,
 					 operand, modulus));
@@ -1247,7 +1247,7 @@
 				       fold (build2 (NE_EXPR,
 						     integer_type_node,
 						     operand,
-						     convert
+						     gnat_convert_internal
 						     (operation_type,
 						      integer_zero_node))),
 				       result, operand));
@@ -1260,7 +1260,7 @@
 		   that constant for nonbinary modulus.  */
 
 		tree cnst = fold (build2 (MINUS_EXPR, operation_type, modulus,
-					  convert (operation_type,
+					  gnat_convert_internal (operation_type,
 						   integer_one_node)));
 
 		if (mod_pow2)
@@ -1279,7 +1279,7 @@
 
     default:
       gcc_assert (operation_type == base_type);
-      result = fold (build1 (op_code, operation_type, convert (operation_type,
+      result = fold (build1 (op_code, operation_type, gnat_convert_internal (operation_type,
 							       operand)));
     }
 
@@ -1291,7 +1291,7 @@
     }
 
   if (result_type && TREE_TYPE (result) != result_type)
-    result = convert (result_type, result);
+    result = gnat_convert_internal (result_type, result);
 
   return result;
 }
@@ -1308,8 +1308,8 @@
   /* The front-end verifies that result, true and false operands have same base
      type.  Convert everything to the result type.  */
 
-  true_operand  = convert (result_type, true_operand);
-  false_operand = convert (result_type, false_operand);
+  true_operand  = gnat_convert_internal (result_type, true_operand);
+  false_operand = gnat_convert_internal (result_type, false_operand);
 
   /* If the result type is unconstrained, take the address of
      the operands and then dereference our result.  */
@@ -1377,7 +1377,7 @@
          would use the "target pointer" return mechanism.  */
 
       if (operation_type != TREE_TYPE (ret_val))
-	ret_val = convert (operation_type, ret_val);
+	ret_val = gnat_convert_internal (operation_type, ret_val);
 
       result_expr
 	= build2 (MODIFY_EXPR, operation_type, result_decl, ret_val);
@@ -1736,11 +1736,11 @@
 	  gnu_args
 	    = chainon (gnu_args,
 		       build_tree_list (NULL_TREE,
-					convert (gnu_size_type, gnu_size)));
+					gnat_convert_internal (gnu_size_type, gnu_size)));
 	  gnu_args
 	    = chainon (gnu_args,
 		       build_tree_list (NULL_TREE,
-					convert (gnu_size_type, gnu_align)));
+					gnat_convert_internal (gnu_size_type, gnu_align)));
 
 	  gnu_call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (gnu_proc)),
 			     gnu_proc_addr, gnu_args, NULL_TREE);
@@ -1769,7 +1769,7 @@
 	  gnu_args
 	    = chainon (gnu_args,
 		       build_tree_list (NULL_TREE,
-					convert (gnu_size_type, gnu_size)));
+					gnat_convert_internal (gnu_size_type, gnu_size)));
 
 	  gnu_call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (gnu_proc)),
 			     gnu_proc_addr, gnu_args, NULL_TREE);
@@ -1798,7 +1798,7 @@
 			       gnu_array_type, NULL_TREE, false, false, false,
 			       false, NULL, gnat_node);
 
-	  return convert (ptr_void_type_node,
+	  return gnat_convert_internal (ptr_void_type_node,
 			  build_unary_op (ADDR_EXPR, NULL_TREE, gnu_decl));
 	}
       else
@@ -1860,14 +1860,14 @@
       storage = build_call_alloc_dealloc (NULL_TREE, size,
 					  TYPE_ALIGN (storage_type),
 					  gnat_proc, gnat_pool, gnat_node);
-      storage = convert (storage_ptr_type, protect_multiple_eval (storage));
+      storage = gnat_convert_internal (storage_ptr_type, protect_multiple_eval (storage));
 
       if (TREE_CODE (type) == RECORD_TYPE && TYPE_IS_PADDING_P (type))
 	{
 	  type = TREE_TYPE (TYPE_FIELDS (type));
 
 	  if (init)
-	    init = convert (type, init);
+	    init = gnat_convert_internal (type, init);
 	}
 
       /* If there is an initializing expression, make a constructor for
@@ -1883,15 +1883,15 @@
 						     init),
 				     template_cons);
 
-	  return convert
+	  return gnat_convert_internal
 	    (result_type,
 	     build2 (COMPOUND_EXPR, storage_ptr_type,
 		     build_binary_op
 		     (MODIFY_EXPR, storage_type,
 		      build_unary_op (INDIRECT_REF, NULL_TREE,
-				      convert (storage_ptr_type, storage)),
+				      gnat_convert_internal (storage_ptr_type, storage)),
 		      gnat_build_constructor (storage_type, template_cons)),
-		     convert (storage_ptr_type, storage)));
+		     gnat_convert_internal (storage_ptr_type, storage)));
 	}
       else
 	return build2
@@ -1900,10 +1900,10 @@
 	   (MODIFY_EXPR, template_type,
 	    build_component_ref
 	    (build_unary_op (INDIRECT_REF, NULL_TREE,
-			     convert (storage_ptr_type, storage)),
+			     gnat_convert_internal (storage_ptr_type, storage)),
 	     NULL_TREE, TYPE_FIELDS (storage_type), 0),
 	    build_template (template_type, type, NULL_TREE)),
-	   convert (result_type, convert (storage_ptr_type, storage)));
+	   gnat_convert_internal (result_type, gnat_convert_internal (storage_ptr_type, storage)));
     }
 
   /* If we have an initializing expression, see if its size is simpler
@@ -1943,15 +1943,15 @@
 					 BIGGEST_ALIGNMENT, Empty,
 					 Empty, gnat_node);
       result = save_expr (result);
-      result = convert (build_pointer_type (new_type), result);
+      result = gnat_convert_internal (build_pointer_type (new_type), result);
       result = build_unary_op (INDIRECT_REF, NULL_TREE, result);
       result = build_component_ref (result, NULL_TREE,
 				    TYPE_FIELDS (new_type), 0);
-      result = convert (result_type,
+      result = gnat_convert_internal (result_type,
 			build_unary_op (ADDR_EXPR, NULL_TREE, result));
     }
   else
-    result = convert (result_type,
+    result = gnat_convert_internal (result_type,
 		      build_call_alloc_dealloc (NULL_TREE, size,
 						TYPE_ALIGN (type),
 						gnat_proc,
@@ -1974,7 +1974,7 @@
 		  result);
     }
 
-  return convert (result_type, result);
+  return gnat_convert_internal (result_type, result);
 }
 
 /* Fill in a VMS descriptor for EXPR and return a constructor for it.
@@ -1993,7 +1993,7 @@
   for (field = TYPE_FIELDS (record_type); field; field = TREE_CHAIN (field))
     const_list
       = tree_cons (field,
-		   convert (TREE_TYPE (field),
+		   gnat_convert_internal (TREE_TYPE (field),
 			    SUBSTITUTE_PLACEHOLDER_IN_EXPR
 			    (DECL_INITIAL (field), expr)),
 		   const_list);
Index: gcc/ada/gigi.h
===================================================================
--- gcc/ada/gigi.h	(revision 111978)
+++ gcc/ada/gigi.h	(working copy)
@@ -461,7 +461,8 @@
    is always TYPE.  This function implements all reasonable
    conversions; callers should filter out those that are
    not permitted by the language being compiled.  */
-extern tree convert (tree type, tree expr);
+extern tree gnat_convert (tree type, tree expr);
+extern tree gnat_convert_internal (tree type, tree expr);
 
 /* Routines created solely for the tree translator's sake. Their prototypes
    can be changed as desired.  */
Index: gcc/ada/cuintp.c
===================================================================
--- gcc/ada/cuintp.c	(revision 111978)
+++ gcc/ada/cuintp.c	(working copy)
@@ -60,7 +60,7 @@
 build_cst_from_int (tree type, HOST_WIDE_INT low)
 {
   if (TREE_CODE (type) == REAL_TYPE)
-    return convert (type, build_int_cst (NULL_TREE, low));
+    return gnat_convert_internal (type, build_int_cst (NULL_TREE, low));
   else
     return force_fit_type (build_int_cst (type, low), false, false, false);
 }
@@ -127,7 +127,7 @@
 						      Udigits_Ptr[Idx])));
     }
 
-  gnu_ret = convert (type, gnu_ret);
+  gnu_ret = gnat_convert_internal (type, gnu_ret);
 
   /* We don't need any NOP_EXPR or NON_LVALUE_EXPR on GNU_RET.  */
   while ((TREE_CODE (gnu_ret) == NOP_EXPR
Index: gcc/c-decl.c
===================================================================
--- gcc/c-decl.c	(revision 111978)
+++ gcc/c-decl.c	(working copy)
@@ -4254,8 +4254,8 @@
 		       if it is a variable the computations will be
 		       done in the proper mode.  */
 		    itype = fold_build2 (MINUS_EXPR, index_type,
-					 convert (index_type, size),
-					 convert (index_type,
+					 c_convert_internal (index_type, size),
+					 c_convert_internal (index_type,
 						  size_one_node));
 
 		    /* If that overflowed, the array is too big.  ??? 
@@ -5726,7 +5726,7 @@
 	    tem = integer_type_node;
 	  else
 	    tem = enumtype;
-	  ini = convert (tem, ini);
+	  ini = c_convert_internal (tem, ini);
 
 	  DECL_INITIAL (enu) = ini;
 	  TREE_PURPOSE (pair) = DECL_NAME (enu);
@@ -5813,7 +5813,7 @@
       pedwarn ("ISO C restricts enumerator values to range of %<int%>");
       /* XXX This causes -pedantic to change the meaning of the program.
 	 Remove?  -zw 2004-03-15  */
-      value = convert (integer_type_node, value);
+      value = c_convert_internal (integer_type_node, value);
     }
 
   /* Set basis for default for next value.  */
@@ -5830,7 +5830,7 @@
 				  && TYPE_UNSIGNED (type)));
 
   decl = build_decl (CONST_DECL, name, type);
-  DECL_INITIAL (decl) = convert (type, value);
+  DECL_INITIAL (decl) = c_convert_internal (type, value);
   pushdecl (decl);
 
   return tree_cons (decl, value, NULL_TREE);
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c	(revision 111978)
+++ gcc/fortran/trans-expr.c	(working copy)
@@ -501,7 +501,7 @@
      All other unary operators have an equivalent GIMPLE unary operator.  */
   if (code == TRUTH_NOT_EXPR)
     se->expr = build2 (EQ_EXPR, type, operand.expr,
-		       convert (type, integer_zero_node));
+		       gfc_convert_internal (type, integer_zero_node));
   else
     se->expr = build1 (code, type, operand.expr);
 
@@ -633,7 +633,7 @@
       tmp = build2 (EQ_EXPR, boolean_type_node, lhs,
 		    fold_convert (TREE_TYPE (lhs), integer_minus_one_node));
       cond = build2 (EQ_EXPR, boolean_type_node, lhs,
-		     convert (TREE_TYPE (lhs), integer_one_node));
+		     gfc_convert_internal (TREE_TYPE (lhs), integer_one_node));
 
       /* If rhs is even,
 	 result = (lhs == 1 || lhs == -1) ? 1 : 0.  */
@@ -641,17 +641,17 @@
         {
 	  tmp = build2 (TRUTH_OR_EXPR, boolean_type_node, tmp, cond);
 	  se->expr = build3 (COND_EXPR, type, tmp,
-			     convert (type, integer_one_node),
-			     convert (type, integer_zero_node));
+			     gfc_convert_internal (type, integer_one_node),
+			     gfc_convert_internal (type, integer_zero_node));
 	  return 1;
 	}
       /* If rhs is odd,
 	 result = (lhs == 1) ? 1 : (lhs == -1) ? -1 : 0.  */
       tmp = build3 (COND_EXPR, type, tmp,
-		    convert (type, integer_minus_one_node),
-		    convert (type, integer_zero_node));
+		    gfc_convert_internal (type, integer_minus_one_node),
+		    gfc_convert_internal (type, integer_zero_node));
       se->expr = build3 (COND_EXPR, type, cond,
-			 convert (type, integer_one_node),
+			 gfc_convert_internal (type, integer_one_node),
 			 tmp);
       return 1;
     }
@@ -708,7 +708,7 @@
 	{
 	case 1:
 	case 2:
-	  rse.expr = convert (gfc_int4_type_node, rse.expr);
+	  rse.expr = gfc_convert_internal (gfc_int4_type_node, rse.expr);
 	  /* Fall through.  */
 
 	case 4:
@@ -731,7 +731,7 @@
 	case 1:
 	case 2:
 	  if (expr->value.op.op1->ts.type == BT_INTEGER)
-	    lse.expr = convert (gfc_int4_type_node, lse.expr);
+	    lse.expr = gfc_convert_internal (gfc_int4_type_node, lse.expr);
 	  else
 	    gcc_unreachable ();
 	  /* Fall through.  */
@@ -841,7 +841,7 @@
     {
       /* Create a temporary variable to hold the result.  */
       tmp = fold_build2 (MINUS_EXPR, gfc_charlen_type_node, len,
-			 convert (gfc_charlen_type_node, integer_one_node));
+			 gfc_convert_internal (gfc_charlen_type_node, integer_one_node));
       tmp = build_range_type (gfc_array_index_type, gfc_index_zero_node, tmp);
       tmp = build_array_type (gfc_character1_type_node, tmp);
       var = gfc_create_var (tmp, "str");
@@ -853,11 +853,11 @@
       var = gfc_create_var (type, "pstr");
       args = gfc_chainon_list (NULL_TREE, len);
       tmp = build_function_call_expr (gfor_fndecl_internal_malloc, args);
-      tmp = convert (type, tmp);
+      tmp = gfc_convert_internal (type, tmp);
       gfc_add_modify_expr (&se->pre, var, tmp);
 
       /* Free the temporary afterwards.  */
-      tmp = convert (pvoid_type_node, var);
+      tmp = gfc_convert_internal (pvoid_type_node, var);
       args = gfc_chainon_list (NULL_TREE, tmp);
       tmp = build_function_call_expr (gfor_fndecl_internal_free, args);
       gfc_add_expr_to_block (&se->post, tmp);
@@ -1084,7 +1084,7 @@
     {
       /* The result of logical ops is always boolean_type_node.  */
       tmp = fold_build2 (code, type, lse.expr, rse.expr);
-      se->expr = convert (type, tmp);
+      se->expr = gfc_convert_internal (type, tmp);
     }
   else
     se->expr = fold_build2 (code, type, lse.expr, rse.expr);
@@ -1867,7 +1867,7 @@
 	      gfc_init_se (&parmse, NULL);
 	      parmse.expr = null_pointer_node;
               if (arg->missing_arg_type == BT_CHARACTER)
-		parmse.string_length = convert (gfc_charlen_type_node,
+		parmse.string_length = gfc_convert_internal (gfc_charlen_type_node,
 						integer_zero_node);
 	    }
 	}
@@ -2003,7 +2003,7 @@
 	  /* Zero the first stride to indicate a temporary.  */
 	  tmp = gfc_conv_descriptor_stride (info->descriptor, gfc_rank_cst[0]);
 	  gfc_add_modify_expr (&se->pre, tmp,
-			       convert (TREE_TYPE (tmp), integer_zero_node));
+			       gfc_convert_internal (TREE_TYPE (tmp), integer_zero_node));
 
 	  /* Pass the temporary as the first argument.  */
 	  tmp = info->descriptor;
@@ -2723,7 +2723,7 @@
 gfc_conv_expr_type (gfc_se * se, gfc_expr * expr, tree type)
 {
   gfc_conv_expr_val (se, expr);
-  se->expr = convert (type, se->expr);
+  se->expr = gfc_convert_internal (type, se->expr);
 }
 
 
Index: gcc/fortran/trans-array.c
===================================================================
--- gcc/fortran/trans-array.c	(revision 111978)
+++ gcc/fortran/trans-array.c	(working copy)
@@ -1525,7 +1525,7 @@
               /* Move the evaluation of scalar expressions outside the
                  scalarization loop.  */
               if (subscript)
-                se.expr = convert(gfc_array_index_type, se.expr);
+                se.expr = gfc_convert_internal (gfc_array_index_type, se.expr);
               se.expr = gfc_evaluate_now (se.expr, &loop->pre);
               gfc_add_block_to_block (&loop->pre, &se.post);
             }
@@ -3399,7 +3399,7 @@
   else
     gcc_unreachable ();
   tmp = build_function_call_expr (fndecl, tmp);
-  tmp = fold (convert (TREE_TYPE (decl), tmp));
+  tmp = fold (gfc_convert_internal (TREE_TYPE (decl), tmp));
   gfc_add_modify_expr (&block, decl, tmp);
 
   /* Set offset of the array.  */
@@ -3413,7 +3413,7 @@
   gfc_add_expr_to_block (&block, fnbody);
 
   /* Free the temporary.  */
-  tmp = convert (pvoid_type_node, decl);
+  tmp = gfc_convert_internal (pvoid_type_node, decl);
   tmp = gfc_chainon_list (NULL_TREE, tmp);
   tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp);
   gfc_add_expr_to_block (&block, tmp);
@@ -3458,7 +3458,7 @@
   /* Set the pointer itself if we aren't using the parameter directly.  */
   if (TREE_CODE (parm) != PARM_DECL)
     {
-      tmp = convert (TREE_TYPE (parm), GFC_DECL_SAVED_DESCRIPTOR (parm));
+      tmp = gfc_convert_internal (TREE_TYPE (parm), GFC_DECL_SAVED_DESCRIPTOR (parm));
       gfc_add_modify_expr (&block, parm, tmp);
     }
   tmp = gfc_finish_block (&block);
@@ -4284,7 +4284,7 @@
       gfc_add_expr_to_block (&block, tmp);
 
       /* Free the temporary.  */
-      tmp = convert (pvoid_type_node, ptr);
+      tmp = gfc_convert_internal (pvoid_type_node, ptr);
       tmp = gfc_chainon_list (NULL_TREE, tmp);
       tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp);
       gfc_add_expr_to_block (&block, tmp);
Index: gcc/fortran/trans-openmp.c
===================================================================
--- gcc/fortran/trans-openmp.c	(revision 111978)
+++ gcc/fortran/trans-openmp.c	(working copy)
@@ -798,7 +798,7 @@
 
   lhsaddr = save_expr (lhsaddr);
   rhs = gfc_evaluate_now (rse.expr, &block);
-  x = convert (TREE_TYPE (rhs), build_fold_indirect_ref (lhsaddr));
+  x = gfc_convert_internal (TREE_TYPE (rhs), build_fold_indirect_ref (lhsaddr));
 
   if (var_on_left)
     x = fold_build2 (op, TREE_TYPE (rhs), x, rhs);
@@ -809,7 +809,7 @@
       && TREE_CODE (type) != COMPLEX_TYPE)
     x = build1 (REALPART_EXPR, TREE_TYPE (TREE_TYPE (rhs)), x);
 
-  x = build2_v (OMP_ATOMIC, lhsaddr, convert (type, x));
+  x = build2_v (OMP_ATOMIC, lhsaddr, gfc_convert_internal (type, x));
   gfc_add_expr_to_block (&block, x);
 
   gfc_add_block_to_block (&block, &lse.pre);
Index: gcc/fortran/gfortran.h
===================================================================
--- gcc/fortran/gfortran.h	(revision 111978)
+++ gcc/fortran/gfortran.h	(working copy)
@@ -1797,6 +1797,10 @@
 extern int gfc_default_complex_kind;
 extern int gfc_c_int_kind;
 
+/* convert.c */
+tree gfc_convert (tree type, tree expr);
+tree gfc_convert_internal (tree type, tree expr);
+
 /* symbol.c */
 void gfc_clear_new_implicit (void);
 try gfc_add_new_implicit_range (int, int);
Index: gcc/fortran/trans-const.c
===================================================================
--- gcc/fortran/trans-const.c	(revision 111978)
+++ gcc/fortran/trans-const.c	(working copy)
@@ -52,7 +52,7 @@
   switch (TREE_CODE (type))
     {
     case INTEGER_TYPE:
-      val = convert (type, intval);
+      val = gfc_convert_internal (type, intval);
       break;
 
     case REAL_TYPE:
Index: gcc/fortran/trans-stmt.c
===================================================================
--- gcc/fortran/trans-stmt.c	(revision 111978)
+++ gcc/fortran/trans-stmt.c	(working copy)
@@ -238,7 +238,7 @@
 	  select_code = code->next;
 	  gcc_assert(select_code->op == EXEC_SELECT);
 	  sym = select_code->expr->symtree->n.sym;
-	  se.expr = convert (gfc_typenode_for_spec (&sym->ts), se.expr);
+	  se.expr = gfc_convert_internal (gfc_typenode_for_spec (&sym->ts), se.expr);
 	  gfc_add_modify_expr (&se.pre, sym->backend_decl, se.expr);
 	}
       else
@@ -780,7 +780,7 @@
     }
   gfc_add_modify_expr (&block, count, tmp);
 
-  count_one = convert (TREE_TYPE (count), integer_one_node);
+  count_one = gfc_convert_internal (TREE_TYPE (count), integer_one_node);
 
   /* Initialize the DO variable: dovar = from.  */
   gfc_add_modify_expr (&block, dovar, from);
@@ -1582,7 +1582,7 @@
   else
     {
       tmpvar = gfc_create_var (build_pointer_type (type), "temp");
-      *pdata = convert (pvoid_type_node, tmpvar);
+      *pdata = gfc_convert_internal (pvoid_type_node, tmpvar);
 
       args = gfc_chainon_list (NULL_TREE, bytesize);
       if (gfc_index_integer_kind == 4)
@@ -1592,7 +1592,7 @@
       else
 	gcc_unreachable ();
       tmp = build_function_call_expr (tmp, args);
-      tmp = convert (TREE_TYPE (tmpvar), tmp);
+      tmp = gfc_convert_internal (TREE_TYPE (tmpvar), tmp);
       gfc_add_modify_expr (pblock, tmpvar, tmp);
     }
   return tmpvar;
@@ -2401,7 +2401,7 @@
       tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (end[n]), end[n], tmp);
 
       tmp = fold_build2 (FLOOR_DIV_EXPR, TREE_TYPE (tmp), tmp, step[n]);
-      tmp = convert (gfc_array_index_type, tmp);
+      tmp = gfc_convert_internal (gfc_array_index_type, tmp);
 
       size = fold_build2 (MULT_EXPR, gfc_array_index_type, size, tmp);
     }
@@ -2455,7 +2455,7 @@
       gfc_add_block_to_block (&body, &se.pre);
 
       /* Store the mask.  */
-      se.expr = convert (smallest_boolean_type_node, se.expr);
+      se.expr = gfc_convert_internal (smallest_boolean_type_node, se.expr);
 
       if (pmask)
 	tmp = build_fold_indirect_ref (mask);
@@ -3470,7 +3470,7 @@
 
       gfc_init_se (&se, NULL);
       gfc_conv_expr_lhs (&se, code->expr);
-      tmp = convert (TREE_TYPE (se.expr), stat);
+      tmp = gfc_convert_internal (TREE_TYPE (se.expr), stat);
       gfc_add_modify_expr (&block, se.expr, tmp);
     }
 
@@ -3574,7 +3574,7 @@
     {
       gfc_init_se (&se, NULL);
       gfc_conv_expr_lhs (&se, code->expr);
-      tmp = convert (TREE_TYPE (se.expr), astat);
+      tmp = gfc_convert_internal (TREE_TYPE (se.expr), astat);
       gfc_add_modify_expr (&block, se.expr, tmp);
     }
 
Index: gcc/fortran/trans.c
===================================================================
--- gcc/fortran/trans.c	(revision 111978)
+++ gcc/fortran/trans.c	(working copy)
@@ -277,7 +277,7 @@
     }
 
   if (type && natural_type != type)
-    t = convert (type, t);
+    t = gfc_convert_internal (type, t);
 
   return t;
 }
Index: gcc/fortran/trans-io.c
===================================================================
--- gcc/fortran/trans-io.c	(revision 111978)
+++ gcc/fortran/trans-io.c	(working copy)
@@ -413,7 +413,7 @@
 
   if (TYPE_MODE (TREE_TYPE (se.expr))
       == TYPE_MODE (TREE_TYPE (TREE_TYPE (p->field))))
-    addr = convert (TREE_TYPE (p->field),
+    addr = gfc_convert_internal (TREE_TYPE (p->field),
 		    build_fold_addr_expr (se.expr));
   else
     {
@@ -424,7 +424,7 @@
 	= gfc_create_var (TREE_TYPE (TREE_TYPE (p->field)),
 			  st_parameter_field[type].name);
       addr = build_fold_addr_expr (tmpvar);
-      tmp = convert (TREE_TYPE (se.expr), tmpvar);
+      tmp = gfc_convert_internal (TREE_TYPE (se.expr), tmpvar);
       gfc_add_modify_expr (postblock, se.expr, tmp);
     }
 
@@ -533,7 +533,7 @@
         gfc_build_cstring_const ("Assigned label is not a format label");
       tmp = GFC_DECL_STRING_LEN (se.expr);
       tmp = build2 (LE_EXPR, boolean_type_node,
-		    tmp, convert (TREE_TYPE (tmp), integer_minus_one_node));
+		    tmp, gfc_convert_internal (TREE_TYPE (tmp), integer_minus_one_node));
       gfc_trans_runtime_check (tmp, msg, &se.pre);
       gfc_add_modify_expr (&se.pre, io,
 		 fold_convert (TREE_TYPE (io), GFC_DECL_ASSIGN_ADDR (se.expr)));
@@ -1296,7 +1296,7 @@
   if (ts->type == BT_CHARACTER)
     NML_ADD_ARG (ts->cl->backend_decl);
   else
-    NML_ADD_ARG (convert (gfc_charlen_type_node, integer_zero_node));
+    NML_ADD_ARG (gfc_convert_internal (gfc_charlen_type_node, integer_zero_node));
 
   NML_ADD_ARG (dtype);
   tmp = build_function_call_expr (iocall[IOCALL_SET_NML_VAL], args);
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c	(revision 111978)
+++ gcc/fortran/trans-decl.c	(working copy)
@@ -382,11 +382,11 @@
     {  
       /* These decls will be dereferenced later, so we don't dereference
 	 them here.  */
-      value = convert (TREE_TYPE (decl), ptr_decl);
+      value = gfc_convert_internal (TREE_TYPE (decl), ptr_decl);
     }
   else
     {
-      ptr_decl = convert (build_pointer_type (TREE_TYPE (decl)),
+      ptr_decl = gfc_convert_internal (build_pointer_type (TREE_TYPE (decl)),
 			  ptr_decl);
       value = build_fold_indirect_ref (ptr_decl);
     }
@@ -1617,7 +1617,7 @@
 	      args = tree_cons (NULL_TREE, null_pointer_node, args);
 	      if (formal->sym->ts.type == BT_CHARACTER)
 		{
-		  tmp = convert (gfc_charlen_type_node, integer_zero_node);
+		  tmp = gfc_convert_internal (gfc_charlen_type_node, integer_zero_node);
 		  string_args = tree_cons (NULL_TREE, tmp, string_args);
 		}
 	    }
Index: gcc/fortran/convert.c
===================================================================
--- gcc/fortran/convert.c	(revision 111978)
+++ gcc/fortran/convert.c	(working copy)
@@ -69,8 +69,9 @@
    not permitted by the language being compiled.  */
 /* We are assuming that given a SIMPLE val, the result will be a SIMPLE rhs.
    If this is not the case, we will abort with an internal error.  */
+
 tree
-convert (tree type, tree expr)
+gfc_convert_internal (tree type, tree expr)
 {
   tree e = expr;
   enum tree_code code = TREE_CODE (type);
@@ -95,7 +96,7 @@
   /* This is incorrect.  A truncation can't be stripped this way.
      Extensions will be stripped by the use of get_unwidened.  */
   if (TREE_CODE (expr) == NOP_EXPR)
-    return convert (type, TREE_OPERAND (expr, 0));
+    return gfc_convert_internal (type, TREE_OPERAND (expr, 0));
 #endif
   if (code == INTEGER_TYPE || code == ENUMERAL_TYPE)
     return fold (convert_to_integer (type, e));
Index: gcc/fortran/trans-intrinsic.c
===================================================================
--- gcc/fortran/trans-intrinsic.c	(revision 111978)
+++ gcc/fortran/trans-intrinsic.c	(working copy)
@@ -222,7 +222,7 @@
       arg = build1 (REALPART_EXPR, artype, arg);
     }
 
-  se->expr = convert (type, arg);
+  se->expr = gfc_convert_internal (type, arg);
 }
 
 /* This is needed because the gcc backend only implements
@@ -241,10 +241,10 @@
   argtype = TREE_TYPE (arg);
   arg = gfc_evaluate_now (arg, pblock);
 
-  intval = convert (type, arg);
+  intval = gfc_convert_internal (type, arg);
   intval = gfc_evaluate_now (intval, pblock);
 
-  tmp = convert (argtype, intval);
+  tmp = gfc_convert_internal (argtype, intval);
   cond = build2 (up ? GE_EXPR : LE_EXPR, boolean_type_node, tmp, arg);
 
   tmp = build2 (up ? PLUS_EXPR : MINUS_EXPR, type, intval,
@@ -412,7 +412,7 @@
   itype = gfc_get_int_type (kind);
 
   tmp = build_fix_expr (&se->pre, arg, itype, op);
-  tmp = convert (type, tmp);
+  tmp = gfc_convert_internal (type, tmp);
   se->expr = build3 (COND_EXPR, type, cond, tmp, arg);
   mpfr_clear (huge);
 }
@@ -435,7 +435,7 @@
   if (TREE_CODE (TREE_TYPE (arg)) == INTEGER_TYPE)
     {
       /* Conversion to a different integer kind.  */
-      se->expr = convert (type, arg);
+      se->expr = gfc_convert_internal (type, arg);
     }
   else
     {
@@ -757,7 +757,7 @@
     se->expr = gfc_conv_descriptor_lbound(desc, bound);
 
   type = gfc_typenode_for_spec (&expr->ts);
-  se->expr = convert (type, se->expr);
+  se->expr = gfc_convert_internal (type, se->expr);
 }
 
 
@@ -816,14 +816,14 @@
 
   type = gfc_typenode_for_spec (&expr->ts);
   arg = gfc_conv_intrinsic_function_args (se, expr);
-  real = convert (TREE_TYPE (type), TREE_VALUE (arg));
+  real = gfc_convert_internal (TREE_TYPE (type), TREE_VALUE (arg));
   if (both)
-    imag = convert (TREE_TYPE (type), TREE_VALUE (TREE_CHAIN (arg)));
+    imag = gfc_convert_internal (TREE_TYPE (type), TREE_VALUE (TREE_CHAIN (arg)));
   else if (TREE_CODE (TREE_TYPE (TREE_VALUE (arg))) == COMPLEX_TYPE)
     {
       arg = TREE_VALUE (arg);
       imag = build1 (IMAGPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg);
-      imag = convert (TREE_TYPE (type), imag);
+      imag = gfc_convert_internal (TREE_TYPE (type), imag);
     }
   else
     imag = build_real_from_int_cst (TREE_TYPE (type), integer_zero_node);
@@ -887,7 +887,7 @@
        tmp = build_fix_expr (&se->pre, tmp, itype, FIX_FLOOR_EXPR);
       else
        tmp = build_fix_expr (&se->pre, tmp, itype, FIX_TRUNC_EXPR);
-      tmp = convert (type, tmp);
+      tmp = gfc_convert_internal (type, tmp);
       tmp = build3 (COND_EXPR, type, test2, tmp, arg);
       tmp = build2 (MULT_EXPR, type, tmp, arg2);
       se->expr = build2 (MINUS_EXPR, type, arg, tmp);
@@ -988,7 +988,7 @@
   arg = expr->value.function.actual->expr;
   gcc_assert (arg->expr_type == EXPR_VARIABLE);
   se->expr = gfc_conv_expr_present (arg->symtree->n.sym);
-  se->expr = convert (gfc_typenode_for_spec (&expr->ts), se->expr);
+  se->expr = gfc_convert_internal (gfc_typenode_for_spec (&expr->ts), se->expr);
 }
 
 
@@ -1007,8 +1007,8 @@
 
   /* Convert the args to double precision before multiplying.  */
   type = gfc_typenode_for_spec (&expr->ts);
-  arg = convert (type, arg);
-  arg2 = convert (type, arg2);
+  arg = gfc_convert_internal (type, arg);
+  arg2 = gfc_convert_internal (type, arg2);
   se->expr = build2 (MULT_EXPR, type, arg, arg2);
 }
 
@@ -1030,7 +1030,7 @@
   type = gfc_character1_type_node;
   var = gfc_create_var (type, "char");
 
-  arg = convert (type, arg);
+  arg = gfc_convert_internal (type, arg);
   gfc_add_modify_expr (&se->pre, var, arg);
   se->expr = gfc_build_addr_expr (build_pointer_type (type), var);
   se->string_length = integer_one_node;
@@ -1180,7 +1180,7 @@
 
   limit = TREE_VALUE (arg);
   if (TREE_TYPE (limit) != type)
-    limit = convert (type, limit);
+    limit = gfc_convert_internal (type, limit);
   /* Only evaluate the argument once.  */
   if (TREE_CODE (limit) != VAR_DECL && !TREE_CONSTANT (limit))
     limit = gfc_evaluate_now(limit, &se->pre);
@@ -1191,13 +1191,13 @@
     {
       val = TREE_VALUE (arg);
       if (TREE_TYPE (val) != type)
-	val = convert (type, val);
+	val = gfc_convert_internal (type, val);
 
       /* Only evaluate the argument once.  */
       if (TREE_CODE (val) != VAR_DECL && !TREE_CONSTANT (val))
         val = gfc_evaluate_now(val, &se->pre);
 
-      thencase = build2_v (MODIFY_EXPR, mvar, convert (type, val));
+      thencase = build2_v (MODIFY_EXPR, mvar, gfc_convert_internal (type, val));
 
       tmp = build2 (op, boolean_type_node, val, limit);
       tmp = build3_v (COND_EXPR, tmp, thencase, elsecase);
@@ -1303,9 +1303,9 @@
   /* Initialize the result.  */
   resvar = gfc_create_var (type, "test");
   if (op == EQ_EXPR)
-    tmp = convert (type, boolean_true_node);
+    tmp = gfc_convert_internal (type, boolean_true_node);
   else
-    tmp = convert (type, boolean_false_node);
+    tmp = gfc_convert_internal (type, boolean_false_node);
   gfc_add_modify_expr (&se->pre, resvar, tmp);
 
   /* Walk the arguments.  */
@@ -1329,9 +1329,9 @@
   /* If the condition matches then set the return value.  */
   gfc_start_block (&block);
   if (op == EQ_EXPR)
-    tmp = convert (type, boolean_false_node);
+    tmp = gfc_convert_internal (type, boolean_false_node);
   else
-    tmp = convert (type, boolean_true_node);
+    tmp = gfc_convert_internal (type, boolean_true_node);
   gfc_add_modify_expr (&block, resvar, tmp);
 
   /* And break out of the loop.  */
@@ -1583,7 +1583,7 @@
   /* Initialize the result.  */
   resvar = gfc_create_var (type, "val");
   if (expr->ts.type == BT_LOGICAL)
-    tmp = convert (type, integer_zero_node);
+    tmp = gfc_convert_internal (type, integer_zero_node);
   else
     tmp = gfc_build_const (type, integer_zero_node);
 
@@ -1852,7 +1852,7 @@
 		     gfc_index_one_node);
   tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, pos, tmp);
   /* And convert to the required type.  */
-  se->expr = convert (type, tmp);
+  se->expr = gfc_convert_internal (type, tmp);
 }
 
 static void
@@ -2018,7 +2018,7 @@
   tmp = fold_build2 (NE_EXPR, boolean_type_node, tmp,
 		     build_int_cst (type, 0));
   type = gfc_typenode_for_spec (&expr->ts);
-  se->expr = convert (type, tmp);
+  se->expr = gfc_convert_internal (type, tmp);
 }
 
 /* Generate code to perform the specified operation.  */
@@ -2138,7 +2138,7 @@
      numbers, and we try to be compatible with other compilers, most
      notably g77, here.  */
   rshift = fold_convert (type, build2 (RSHIFT_EXPR, utype, 
-				       convert (utype, arg), width));
+				      gfc_convert_internal (utype, arg), width));
 
   tmp = fold_build2 (GE_EXPR, boolean_type_node, arg2,
 		     build_int_cst (TREE_TYPE (arg2), 0));
@@ -2182,14 +2182,14 @@
 	 aligned to at least 32 bits, so there's no loss.  */
       if (expr->ts.kind < 4)
 	{
-	  tmp = convert (int4type, TREE_VALUE (arg));
+	  tmp =gfc_convert_internal (int4type, TREE_VALUE (arg));
 	  TREE_VALUE (arg) = tmp;
 	}
       /* Convert the SHIFT and SIZE args to INTEGER*4 otherwise we would
          need loads of library  functions.  They cannot have values >
 	 BIT_SIZE (I) so the conversion is safe.  */
-      TREE_VALUE (arg2) = convert (int4type, TREE_VALUE (arg2));
-      TREE_VALUE (arg3) = convert (int4type, TREE_VALUE (arg3));
+      TREE_VALUE (arg2) =gfc_convert_internal (int4type, TREE_VALUE (arg2));
+      TREE_VALUE (arg3) =gfc_convert_internal (int4type, TREE_VALUE (arg3));
 
       switch (expr->ts.kind)
 	{
@@ -2211,7 +2211,7 @@
       /* Convert the result back to the original type, if we extended
 	 the first argument's width above.  */
       if (expr->ts.kind < 4)
-	se->expr = convert (type, se->expr);
+	se->expr =gfc_convert_internal (type, se->expr);
 
       return;
     }
@@ -2285,7 +2285,7 @@
 	}
       break;
     }
-  se->expr = convert (type, len);
+  se->expr =gfc_convert_internal (type, len);
 }
 
 /* The length of a character string not including trailing blanks.  */
@@ -2298,7 +2298,7 @@
   args = gfc_conv_intrinsic_function_args (se, expr);
   type = gfc_typenode_for_spec (&expr->ts);
   se->expr = build_function_call_expr (gfor_fndecl_string_len_trim, args);
-  se->expr = convert (type, se->expr);
+  se->expr =gfc_convert_internal (type, se->expr);
 }
 
 
@@ -2325,11 +2325,11 @@
   else
     {
       back = TREE_CHAIN (tmp);
-      TREE_VALUE (back) = convert (logical4_type_node, TREE_VALUE (back));
+      TREE_VALUE (back) =gfc_convert_internal (logical4_type_node, TREE_VALUE (back));
     }
 
   se->expr = build_function_call_expr (gfor_fndecl_string_index, args);
-  se->expr = convert (type, se->expr);
+  se->expr =gfc_convert_internal (type, se->expr);
 }
 
 /* The ascii value for a single character.  */
@@ -2346,7 +2346,7 @@
   type = gfc_typenode_for_spec (&expr->ts);
 
   se->expr = build_fold_indirect_ref (arg);
-  se->expr = convert (type, se->expr);
+  se->expr =gfc_convert_internal (type, se->expr);
 }
 
 
@@ -2425,7 +2425,7 @@
 
   se->expr = build_function_call_expr (fndecl, args);
   type = gfc_typenode_for_spec (&expr->ts);
-  se->expr = convert (type, se->expr);
+  se->expr =gfc_convert_internal (type, se->expr);
 }
 
 
@@ -2502,7 +2502,7 @@
 
   arg = arg->next;
   type = gfc_typenode_for_spec (&expr->ts);
-  ptr = convert (build_pointer_type (type), ptr);
+  ptr =gfc_convert_internal (build_pointer_type (type), ptr);
   if (expr->ts.type == BT_CHARACTER)
     {
       gfc_init_se (&argse, NULL);
@@ -2539,7 +2539,7 @@
   tmp = gfc_conv_descriptor_data_get (arg1se.expr);
   tmp = build2 (NE_EXPR, boolean_type_node, tmp,
 		fold_convert (TREE_TYPE (tmp), null_pointer_node));
-  se->expr = convert (gfc_typenode_for_spec (&expr->ts), tmp);
+  se->expr =gfc_convert_internal (gfc_typenode_for_spec (&expr->ts), tmp);
 }
 
 
@@ -2620,7 +2620,7 @@
           se->expr = build_function_call_expr (fndecl, args);
         }
      }
-  se->expr = convert (gfc_typenode_for_spec (&expr->ts), se->expr);
+  se->expr =gfc_convert_internal (gfc_typenode_for_spec (&expr->ts), se->expr);
 }
 
 
@@ -2647,11 +2647,11 @@
   else
     {
       back = TREE_CHAIN (tmp);
-      TREE_VALUE (back) = convert (logical4_type_node, TREE_VALUE (back));
+      TREE_VALUE (back) =gfc_convert_internal (logical4_type_node, TREE_VALUE (back));
     }
 
   se->expr = build_function_call_expr (gfor_fndecl_string_scan, args);
-  se->expr = convert (type, se->expr);
+  se->expr =gfc_convert_internal (type, se->expr);
 }
 
 
@@ -2680,11 +2680,11 @@
   else
     {
       back = TREE_CHAIN (tmp);
-      TREE_VALUE (back) = convert (logical4_type_node, TREE_VALUE (back));
+      TREE_VALUE (back) =gfc_convert_internal (logical4_type_node, TREE_VALUE (back));
     }
 
   se->expr = build_function_call_expr (gfor_fndecl_string_verify, args);
-  se->expr = convert (type, se->expr);
+  se->expr =gfc_convert_internal (type, se->expr);
 }
 
 /* Prepare components and related information of a real number which is
@@ -2724,9 +2724,9 @@
    /* Calculate the numbers of bits of exponent, fraction and word  */
    n = gfc_validate_kind (a1->ts.type, a1->ts.kind, false);
    tmp = build_int_cst (NULL_TREE, gfc_real_kinds[n].digits - 1);
-   rcs->fdigits = convert (masktype, tmp);
+   rcs->fdigits =gfc_convert_internal (masktype, tmp);
    wbits = build_int_cst (NULL_TREE, TYPE_PRECISION (rcs->type) - 1);
-   wbits = convert (masktype, wbits);
+   wbits =gfc_convert_internal (masktype, wbits);
    rcs->edigits = fold_build2 (MINUS_EXPR, masktype, wbits, tmp);
 
    /* Form masks for exponent/fraction/sign  */
@@ -2776,7 +2776,7 @@
   parms = tree_cons (NULL, op0, NULL);
   call = build_function_call_expr (fn, parms);
 
-  return convert (result_type, call);
+  return gfc_convert_internal (result_type, call);
 }
 
 
@@ -3041,7 +3041,7 @@
     gfc_conv_expr_reference (se, arg_expr);
   else
     gfc_conv_array_parameter (se, arg_expr, ss, 1); 
-  se->expr= convert (gfc_unsigned_type (long_integer_type_node), 
+  se->expr=gfc_convert_internal (gfc_unsigned_type (long_integer_type_node), 
 		     se->expr);
    
   /* Create a temporary variable for loc return value.  Without this, 
Index: gcc/langhooks.c
===================================================================
--- gcc/langhooks.c	(revision 111978)
+++ gcc/langhooks.c	(working copy)
@@ -36,6 +36,8 @@
 #include "langhooks-def.h"
 #include "ggc.h"
 #include "diagnostic.h"
+#include "convert.h"
+#include "c-common.h"
 
 /* Do nothing; in many cases the default hook.  */
 
@@ -578,3 +580,1711 @@
 				   tree t ATTRIBUTE_UNUSED)
 {
 }
+
+static bool
+c_promoting_integer_type_p2 (tree t)
+{
+  switch (TREE_CODE (t))
+    {
+    case INTEGER_TYPE:
+      return (TYPE_MAIN_VARIANT (t) == char_type_node
+	      || TYPE_MAIN_VARIANT (t) == signed_char_type_node
+	      || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node
+	      || TYPE_MAIN_VARIANT (t) == short_integer_type_node
+	      || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node
+	      || TYPE_PRECISION (t) < TYPE_PRECISION (integer_type_node));
+
+    case ENUMERAL_TYPE:
+      /* ??? Technically all enumerations not larger than an int
+	 promote to an int.  But this is used along code paths
+	 that only want to notice a size change.  */
+      return TYPE_PRECISION (t) < TYPE_PRECISION (integer_type_node);
+
+    case BOOLEAN_TYPE:
+      return 1;
+
+    default:
+      return 0;
+    }
+}
+
+static tree
+c_common_type_for_size2 (unsigned int bits, int unsignedp)
+{
+  if (bits == TYPE_PRECISION (integer_type_node))
+    return unsignedp ? unsigned_type_node : integer_type_node;
+
+  if (bits == TYPE_PRECISION (signed_char_type_node))
+    return unsignedp ? unsigned_char_type_node : signed_char_type_node;
+
+  if (bits == TYPE_PRECISION (short_integer_type_node))
+    return unsignedp ? short_unsigned_type_node : short_integer_type_node;
+
+  if (bits == TYPE_PRECISION (long_integer_type_node))
+    return unsignedp ? long_unsigned_type_node : long_integer_type_node;
+
+  if (bits == TYPE_PRECISION (long_long_integer_type_node))
+    return (unsignedp ? long_long_unsigned_type_node
+	    : long_long_integer_type_node);
+
+/*   if (bits == TYPE_PRECISION (widest_integer_literal_type_node)) */
+/*     return (unsignedp ? widest_unsigned_literal_type_node */
+/* 	    : widest_integer_literal_type_node); */
+
+  if (bits <= TYPE_PRECISION (intQI_type_node))
+    return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
+
+  if (bits <= TYPE_PRECISION (intHI_type_node))
+    return unsignedp ? unsigned_intHI_type_node : intHI_type_node;
+
+  if (bits <= TYPE_PRECISION (intSI_type_node))
+    return unsignedp ? unsigned_intSI_type_node : intSI_type_node;
+
+  if (bits <= TYPE_PRECISION (intDI_type_node))
+    return unsignedp ? unsigned_intDI_type_node : intDI_type_node;
+
+  return 0;
+}
+
+static tree
+perform_integral_promotions2 (tree exp)
+{
+  tree type = TREE_TYPE (exp);
+  enum tree_code code = TREE_CODE (type);
+
+  gcc_assert (INTEGRAL_TYPE_P (type));
+
+  /* Normally convert enums to int,
+     but convert wide enums to something wider.  */
+  if (code == ENUMERAL_TYPE)
+    {
+      type =  c_common_type_for_size2 (MAX (TYPE_PRECISION (type),
+					  TYPE_PRECISION (integer_type_node)),
+				     ((TYPE_PRECISION (type)
+				       >= TYPE_PRECISION (integer_type_node))
+				      && TYPE_UNSIGNED (type)));
+
+      return convert2 (type, exp);
+    }
+
+  /* ??? This should no longer be needed now bit-fields have their
+     proper types.  */
+  if (TREE_CODE (exp) == COMPONENT_REF
+      && DECL_C_BIT_FIELD (TREE_OPERAND (exp, 1))
+      /* If it's thinner than an int, promote it like a
+	 c_promoting_integer_type_p, otherwise leave it alone.  */
+      && 0 > compare_tree_int (DECL_SIZE (TREE_OPERAND (exp, 1)),
+			       TYPE_PRECISION (integer_type_node)))
+    return convert2 (integer_type_node, exp);
+
+  if (c_promoting_integer_type_p2 (type))
+    {
+      /* Preserve unsignedness if not really getting any wider.  */
+      if (TYPE_UNSIGNED (type)
+	  && TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
+	return convert2 (unsigned_type_node, exp);
+
+      return convert2 (integer_type_node, exp);
+    }
+
+  return exp;
+}
+
+static tree
+default_conversion2 (tree exp)
+{
+  tree orig_exp;
+  tree type = TREE_TYPE (exp);
+  enum tree_code code = TREE_CODE (type);
+
+  /* Functions and arrays have been converted during parsing.  */
+  gcc_assert (code != FUNCTION_TYPE);
+  if (code == ARRAY_TYPE)
+    return exp;
+
+  /* Constants can be used directly unless they're not loadable.  */
+  if (TREE_CODE (exp) == CONST_DECL)
+    exp = DECL_INITIAL (exp);
+
+  /* Replace a nonvolatile const static variable with its value unless
+     it is an array, in which case we must be sure that taking the
+     address of the array produces consistent results.  */
+  else if (optimize && TREE_CODE (exp) == VAR_DECL && code != ARRAY_TYPE)
+    {
+/*       exp = decl_constant_value_for_broken_optimization (exp); */
+/*       type = TREE_TYPE (exp); */
+    }
+
+  /* Strip no-op conversions.  */
+  orig_exp = exp;
+  STRIP_TYPE_NOPS (exp);
+
+  if (TREE_NO_WARNING (orig_exp))
+    TREE_NO_WARNING (exp) = 1;
+
+  if (INTEGRAL_TYPE_P (type))
+    return  perform_integral_promotions2 (exp);
+
+  if (code == VOID_TYPE)
+    {
+      error ("void value not ignored as it ought to be");
+      return error_mark_node;
+    }
+  return exp;
+}
+
+static tree
+c_common_type (tree t1, tree t2)
+{
+  enum tree_code code1;
+  enum tree_code code2;
+
+  /* If one type is nonsense, use the other.  */
+  if (t1 == error_mark_node)
+    return t2;
+  if (t2 == error_mark_node)
+    return t1;
+
+  if (TYPE_QUALS (t1) != TYPE_UNQUALIFIED)
+    t1 = TYPE_MAIN_VARIANT (t1);
+
+  if (TYPE_QUALS (t2) != TYPE_UNQUALIFIED)
+    t2 = TYPE_MAIN_VARIANT (t2);
+
+  if (TYPE_ATTRIBUTES (t1) != NULL_TREE)
+    t1 = build_type_attribute_variant (t1, NULL_TREE);
+
+  if (TYPE_ATTRIBUTES (t2) != NULL_TREE)
+    t2 = build_type_attribute_variant (t2, NULL_TREE);
+
+  /* Save time if the two types are the same.  */
+
+  if (t1 == t2) return t1;
+
+  code1 = TREE_CODE (t1);
+  code2 = TREE_CODE (t2);
+
+  gcc_assert (code1 == VECTOR_TYPE || code1 == COMPLEX_TYPE
+	      || code1 == REAL_TYPE || code1 == INTEGER_TYPE);
+  gcc_assert (code2 == VECTOR_TYPE || code2 == COMPLEX_TYPE
+	      || code2 == REAL_TYPE || code2 == INTEGER_TYPE);
+
+  /* If one type is a vector type, return that type.  (How the usual
+     arithmetic conversions apply to the vector types extension is not
+     precisely specified.)  */
+  if (code1 == VECTOR_TYPE)
+    return t1;
+
+  if (code2 == VECTOR_TYPE)
+    return t2;
+
+  /* If one type is complex, form the common type of the non-complex
+     components, then make that complex.  Use T1 or T2 if it is the
+     required type.  */
+  if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE)
+    {
+      tree subtype1 = code1 == COMPLEX_TYPE ? TREE_TYPE (t1) : t1;
+      tree subtype2 = code2 == COMPLEX_TYPE ? TREE_TYPE (t2) : t2;
+      tree subtype = c_common_type (subtype1, subtype2);
+
+      if (code1 == COMPLEX_TYPE && TREE_TYPE (t1) == subtype)
+	return t1;
+      else if (code2 == COMPLEX_TYPE && TREE_TYPE (t2) == subtype)
+	return t2;
+      else
+	return build_complex_type (subtype);
+    }
+
+  /* If only one is real, use it as the result.  */
+
+  if (code1 == REAL_TYPE && code2 != REAL_TYPE)
+    return t1;
+
+  if (code2 == REAL_TYPE && code1 != REAL_TYPE)
+    return t2;
+
+  /* If both are real and either are decimal floating point types, use
+     the decimal floating point type with the greater precision. */
+
+  if (code1 == REAL_TYPE && code2 == REAL_TYPE)
+    {
+      if (TYPE_MAIN_VARIANT (t1) == dfloat128_type_node
+	  || TYPE_MAIN_VARIANT (t2) == dfloat128_type_node)
+	return dfloat128_type_node;
+      else if (TYPE_MAIN_VARIANT (t1) == dfloat64_type_node
+	       || TYPE_MAIN_VARIANT (t2) == dfloat64_type_node)
+	return dfloat64_type_node;
+      else if (TYPE_MAIN_VARIANT (t1) == dfloat32_type_node
+	       || TYPE_MAIN_VARIANT (t2) == dfloat32_type_node)
+	return dfloat32_type_node;
+    }
+
+  /* Both real or both integers; use the one with greater precision.  */
+
+  if (TYPE_PRECISION (t1) > TYPE_PRECISION (t2))
+    return t1;
+  else if (TYPE_PRECISION (t2) > TYPE_PRECISION (t1))
+    return t2;
+
+  /* Same precision.  Prefer long longs to longs to ints when the
+     same precision, following the C99 rules on integer type rank
+     (which are equivalent to the C90 rules for C90 types).  */
+
+  if (TYPE_MAIN_VARIANT (t1) == long_long_unsigned_type_node
+      || TYPE_MAIN_VARIANT (t2) == long_long_unsigned_type_node)
+    return long_long_unsigned_type_node;
+
+  if (TYPE_MAIN_VARIANT (t1) == long_long_integer_type_node
+      || TYPE_MAIN_VARIANT (t2) == long_long_integer_type_node)
+    {
+      if (TYPE_UNSIGNED (t1) || TYPE_UNSIGNED (t2))
+	return long_long_unsigned_type_node;
+      else
+        return long_long_integer_type_node;
+    }
+
+  if (TYPE_MAIN_VARIANT (t1) == long_unsigned_type_node
+      || TYPE_MAIN_VARIANT (t2) == long_unsigned_type_node)
+    return long_unsigned_type_node;
+
+  if (TYPE_MAIN_VARIANT (t1) == long_integer_type_node
+      || TYPE_MAIN_VARIANT (t2) == long_integer_type_node)
+    {
+      /* But preserve unsignedness from the other type,
+	 since long cannot hold all the values of an unsigned int.  */
+      if (TYPE_UNSIGNED (t1) || TYPE_UNSIGNED (t2))
+	return long_unsigned_type_node;
+      else
+	return long_integer_type_node;
+    }
+
+  /* Likewise, prefer long double to double even if same size.  */
+  if (TYPE_MAIN_VARIANT (t1) == long_double_type_node
+      || TYPE_MAIN_VARIANT (t2) == long_double_type_node)
+    return long_double_type_node;
+
+  /* Otherwise prefer the unsigned one.  */
+
+  if (TYPE_UNSIGNED (t1))
+    return t1;
+  else
+    return t2;
+}
+
+static tree
+c_common_signed_or_unsigned_type2 (int unsignedp, tree type)
+{
+  if (!INTEGRAL_TYPE_P (type)
+      || TYPE_UNSIGNED (type) == unsignedp)
+    return type;
+
+  /* For ENUMERAL_TYPEs in C++, must check the mode of the types, not
+     the precision; they have precision set to match their range, but
+     may use a wider mode to match an ABI.  If we change modes, we may
+     wind up with bad conversions.  For INTEGER_TYPEs in C, must check
+     the precision as well, so as to yield correct results for
+     bit-field types.  C++ does not have these separate bit-field
+     types, and producing a signed or unsigned variant of an
+     ENUMERAL_TYPE may cause other problems as well.  */
+
+#define TYPE_OK(node)							    \
+  (TYPE_MODE (type) == TYPE_MODE (node)					    \
+   && (c_dialect_cxx () || TYPE_PRECISION (type) == TYPE_PRECISION (node)))
+/*   if (TYPE_OK (signed_char_type_node)) */
+/*     return unsignedp ? unsigned_char_type_node : signed_char_type_node; */
+/*   if (TYPE_OK (integer_type_node)) */
+/*     return unsignedp ? unsigned_type_node : integer_type_node; */
+/*   if (TYPE_OK (short_integer_type_node)) */
+/*     return unsignedp ? short_unsigned_type_node : short_integer_type_node; */
+/*   if (TYPE_OK (long_integer_type_node)) */
+/*     return unsignedp ? long_unsigned_type_node : long_integer_type_node; */
+/*   if (TYPE_OK (long_long_integer_type_node)) */
+/*     return (unsignedp ? long_long_unsigned_type_node */
+/* 	    : long_long_integer_type_node); */
+/*   if (TYPE_OK (widest_integer_literal_type_node)) */
+/*     return (unsignedp ? widest_unsigned_literal_type_node */
+/* 	    : widest_integer_literal_type_node); */
+
+#if HOST_BITS_PER_WIDE_INT >= 64
+  if (TYPE_OK (intTI_type_node))
+    return unsignedp ? unsigned_intTI_type_node : intTI_type_node;
+#endif
+/*   if (TYPE_OK (intDI_type_node)) */
+/*     return unsignedp ? unsigned_intDI_type_node : intDI_type_node; */
+/*   if (TYPE_OK (intSI_type_node)) */
+/*     return unsignedp ? unsigned_intSI_type_node : intSI_type_node; */
+/*   if (TYPE_OK (intHI_type_node)) */
+/*     return unsignedp ? unsigned_intHI_type_node : intHI_type_node; */
+/*   if (TYPE_OK (intQI_type_node)) */
+/*     return unsignedp ? unsigned_intQI_type_node : intQI_type_node; */
+#undef TYPE_OK
+
+/*   if (c_dialect_cxx ()) */
+    return type;
+/*   else */
+/*     return build_nonstandard_integer_type (TYPE_PRECISION (type), unsignedp); */
+}
+
+static tree
+shorten_compare2 (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr,
+		 enum tree_code *rescode_ptr)
+{
+  tree type;
+  tree op0 = *op0_ptr;
+  tree op1 = *op1_ptr;
+  int unsignedp0, unsignedp1;
+  int real1, real2;
+  tree primop0, primop1;
+  enum tree_code code = *rescode_ptr;
+
+  /* Throw away any conversions to wider types
+     already present in the operands.  */
+
+  primop0 = get_narrower (op0, &unsignedp0);
+  primop1 = get_narrower (op1, &unsignedp1);
+
+  /* Handle the case that OP0 does not *contain* a conversion
+     but it *requires* conversion to FINAL_TYPE.  */
+
+  if (op0 == primop0 && TREE_TYPE (op0) != *restype_ptr)
+    unsignedp0 = TYPE_UNSIGNED (TREE_TYPE (op0));
+  if (op1 == primop1 && TREE_TYPE (op1) != *restype_ptr)
+    unsignedp1 = TYPE_UNSIGNED (TREE_TYPE (op1));
+
+  /* If one of the operands must be floated, we cannot optimize.  */
+  real1 = TREE_CODE (TREE_TYPE (primop0)) == REAL_TYPE;
+  real2 = TREE_CODE (TREE_TYPE (primop1)) == REAL_TYPE;
+
+  /* If first arg is constant, swap the args (changing operation
+     so value is preserved), for canonicalization.  Don't do this if
+     the second arg is 0.  */
+
+  if (TREE_CONSTANT (primop0)
+      && !integer_zerop (primop1) && !real_zerop (primop1))
+    {
+      tree tem = primop0;
+      int temi = unsignedp0;
+      primop0 = primop1;
+      primop1 = tem;
+      tem = op0;
+      op0 = op1;
+      op1 = tem;
+      *op0_ptr = op0;
+      *op1_ptr = op1;
+      unsignedp0 = unsignedp1;
+      unsignedp1 = temi;
+      temi = real1;
+      real1 = real2;
+      real2 = temi;
+
+      switch (code)
+	{
+	case LT_EXPR:
+	  code = GT_EXPR;
+	  break;
+	case GT_EXPR:
+	  code = LT_EXPR;
+	  break;
+	case LE_EXPR:
+	  code = GE_EXPR;
+	  break;
+	case GE_EXPR:
+	  code = LE_EXPR;
+	  break;
+	default:
+	  break;
+	}
+      *rescode_ptr = code;
+    }
+
+  /* If comparing an integer against a constant more bits wide,
+     maybe we can deduce a value of 1 or 0 independent of the data.
+     Or else truncate the constant now
+     rather than extend the variable at run time.
+
+     This is only interesting if the constant is the wider arg.
+     Also, it is not safe if the constant is unsigned and the
+     variable arg is signed, since in this case the variable
+     would be sign-extended and then regarded as unsigned.
+     Our technique fails in this case because the lowest/highest
+     possible unsigned results don't follow naturally from the
+     lowest/highest possible values of the variable operand.
+     For just EQ_EXPR and NE_EXPR there is another technique that
+     could be used: see if the constant can be faithfully represented
+     in the other operand's type, by truncating it and reextending it
+     and see if that preserves the constant's value.  */
+
+  if (!real1 && !real2
+      && TREE_CODE (primop1) == INTEGER_CST
+      && TYPE_PRECISION (TREE_TYPE (primop0)) < TYPE_PRECISION (*restype_ptr))
+    {
+      int min_gt, max_gt, min_lt, max_lt;
+      tree maxval, minval;
+      /* 1 if comparison is nominally unsigned.  */
+      int unsignedp = TYPE_UNSIGNED (*restype_ptr);
+      tree val;
+
+      type = 	c_common_signed_or_unsigned_type2 (unsignedp0,
+						  TREE_TYPE (primop0));
+
+      maxval = TYPE_MAX_VALUE (type);
+      minval = TYPE_MIN_VALUE (type);
+
+      if (unsignedp && !unsignedp0)
+	*restype_ptr = error_mark_node;
+/* 	  c_common_signed_type (*restype_ptr); */
+
+      if (TREE_TYPE (primop1) != *restype_ptr)
+	{
+	  /* Convert primop1 to target type, but do not introduce
+	     additional overflow.  We know primop1 is an int_cst.  */
+	  tree tmp = build_int_cst_wide (*restype_ptr,
+					 TREE_INT_CST_LOW (primop1),
+					 TREE_INT_CST_HIGH (primop1));
+
+	  primop1 = force_fit_type (tmp, 0, TREE_OVERFLOW (primop1),
+				    TREE_CONSTANT_OVERFLOW (primop1));
+	}
+      if (type != *restype_ptr)
+	{
+	  minval = convert2 (*restype_ptr, minval);
+	  maxval = convert2 (*restype_ptr, maxval);
+	}
+
+      if (unsignedp && unsignedp0)
+	{
+	  min_gt = INT_CST_LT_UNSIGNED (primop1, minval);
+	  max_gt = INT_CST_LT_UNSIGNED (primop1, maxval);
+	  min_lt = INT_CST_LT_UNSIGNED (minval, primop1);
+	  max_lt = INT_CST_LT_UNSIGNED (maxval, primop1);
+	}
+      else
+	{
+	  min_gt = INT_CST_LT (primop1, minval);
+	  max_gt = INT_CST_LT (primop1, maxval);
+	  min_lt = INT_CST_LT (minval, primop1);
+	  max_lt = INT_CST_LT (maxval, primop1);
+	}
+
+      val = 0;
+      /* This used to be a switch, but Genix compiler can't handle that.  */
+      if (code == NE_EXPR)
+	{
+	  if (max_lt || min_gt)
+	    val = error_mark_node; /* truthvalue_true_node; */
+	}
+      else if (code == EQ_EXPR)
+	{
+	  if (max_lt || min_gt)
+	    val = error_mark_node; /* truthvalue_false_node; */
+	}
+      else if (code == LT_EXPR)
+	{
+	  if (max_lt)
+	    val = error_mark_node; /* truthvalue_true_node; */
+	  if (!min_lt)
+	    val = error_mark_node; /* truthvalue_false_node; */
+	}
+      else if (code == GT_EXPR)
+	{
+	  val = error_mark_node;
+/* 	  if (min_gt) */
+/* 	    val = truthvalue_true_node; */
+/* 	  if (!max_gt) */
+/* 	    val = truthvalue_false_node; */
+	}
+      else if (code == LE_EXPR)
+	{
+	  val = error_mark_node;
+/* 	  if (!max_gt) */
+/* 	    val = truthvalue_true_node; */
+/* 	  if (min_gt) */
+/* 	    val = truthvalue_false_node; */
+	}
+      else if (code == GE_EXPR)
+	{
+	  val = error_mark_node;
+/* 	  if (!min_lt) */
+/* 	    val = truthvalue_true_node; */
+/* 	  if (max_lt) */
+/* 	    val = truthvalue_false_node; */
+	}
+
+      /* If primop0 was sign-extended and unsigned comparison specd,
+	 we did a signed comparison above using the signed type bounds.
+	 But the comparison we output must be unsigned.
+
+	 Also, for inequalities, VAL is no good; but if the signed
+	 comparison had *any* fixed result, it follows that the
+	 unsigned comparison just tests the sign in reverse
+	 (positive values are LE, negative ones GE).
+	 So we can generate an unsigned comparison
+	 against an extreme value of the signed type.  */
+
+      if (unsignedp && !unsignedp0)
+	{
+	  if (val != 0)
+	    switch (code)
+	      {
+	      case LT_EXPR:
+	      case GE_EXPR:
+		primop1 = TYPE_MIN_VALUE (type);
+		val = 0;
+		break;
+
+	      case LE_EXPR:
+	      case GT_EXPR:
+		primop1 = TYPE_MAX_VALUE (type);
+		val = 0;
+		break;
+
+	      default:
+		break;
+	      }
+	  type = error_mark_node;
+	    /* c_common_unsigned_type (type); */
+	}
+
+      if (TREE_CODE (primop0) != INTEGER_CST)
+	{
+/* 	  if (val == truthvalue_false_node) */
+/* 	    warning (0, "comparison is always false due to limited range of data type"); */
+/* 	  if (val == truthvalue_true_node) */
+/* 	    warning (0, "comparison is always true due to limited range of data type"); */
+	}
+
+      if (val != 0)
+	{
+	  /* Don't forget to evaluate PRIMOP0 if it has side effects.  */
+	  if (TREE_SIDE_EFFECTS (primop0))
+	    return build2 (COMPOUND_EXPR, TREE_TYPE (val), primop0, val);
+	  return val;
+	}
+
+      /* Value is not predetermined, but do the comparison
+	 in the type of the operand that is not constant.
+	 TYPE is already properly set.  */
+    }
+
+  /* If either arg is decimal float and the other is float, find the
+     proper common type to use for comparison.  */
+  else if (real1 && real2
+	   && (DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (primop0)))
+	       || DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (primop1)))))
+    type = error_mark_node;
+  /* common_type (TREE_TYPE (primop0), TREE_TYPE (primop1)); */
+
+  else if (real1 && real2
+	   && (TYPE_PRECISION (TREE_TYPE (primop0))
+	       == TYPE_PRECISION (TREE_TYPE (primop1))))
+    type = TREE_TYPE (primop0);
+
+  /* If args' natural types are both narrower than nominal type
+     and both extend in the same manner, compare them
+     in the type of the wider arg.
+     Otherwise must actually extend both to the nominal
+     common type lest different ways of extending
+     alter the result.
+     (eg, (short)-1 == (unsigned short)-1  should be 0.)  */
+
+  else if (unsignedp0 == unsignedp1 && real1 == real2
+	   && TYPE_PRECISION (TREE_TYPE (primop0)) < TYPE_PRECISION (*restype_ptr)
+	   && TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (*restype_ptr))
+    {
+      type = error_mark_node;
+      /* common_type (TREE_TYPE (primop0), TREE_TYPE (primop1)); */
+      type = error_mark_node;
+      /* c_common_signed_or_unsigned_type (unsignedp0 */
+/* 					       || TYPE_UNSIGNED (*restype_ptr), */
+/* 					       type); */
+      /* Make sure shorter operand is extended the right way
+	 to match the longer operand.  */
+      primop0
+	= convert2 (error_mark_node,
+		    /* c_common_signed_or_unsigned_type (unsignedp0, */
+/* 						     TREE_TYPE (primop0)), */
+		   primop0);
+      primop1
+	= convert2 (error_mark_node,
+/* 		    c_common_signed_or_unsigned_type (unsignedp1, */
+/* 						     TREE_TYPE (primop1)), */
+		   primop1);
+    }
+  else
+    {
+      /* Here we must do the comparison on the nominal type
+	 using the args exactly as we received them.  */
+      type = *restype_ptr;
+      primop0 = op0;
+      primop1 = op1;
+
+      if (!real1 && !real2 && integer_zerop (primop1)
+	  && TYPE_UNSIGNED (*restype_ptr))
+	{
+	  tree value = 0;
+	  switch (code)
+	    {
+	    case GE_EXPR:
+	      /* All unsigned values are >= 0, so we warn if extra warnings
+		 are requested.  However, if OP0 is a constant that is
+		 >= 0, the signedness of the comparison isn't an issue,
+		 so suppress the warning.  */
+	      if (extra_warnings && !in_system_header
+		  && !(TREE_CODE (primop0) == INTEGER_CST
+		       && !TREE_OVERFLOW (convert2 (error_mark_node,
+/* 						    c_common_signed_type (type), */
+						   primop0))))
+		warning (0, "comparison of unsigned expression >= 0 is always true");
+	      value = error_mark_node; /* truthvalue_true_node; */
+	      break;
+
+	    case LT_EXPR:
+	      if (extra_warnings && !in_system_header
+		  && !(TREE_CODE (primop0) == INTEGER_CST
+		       && !TREE_OVERFLOW (convert2 (error_mark_node,
+/* 						    c_common_signed_type (type), */
+						   primop0))))
+		warning (0, "comparison of unsigned expression < 0 is always false");
+	      value = error_mark_node; /* truthvalue_false_node; */
+	      break;
+
+	    default:
+	      break;
+	    }
+
+	  if (value != 0)
+	    {
+	      /* Don't forget to evaluate PRIMOP0 if it has side effects.  */
+	      if (TREE_SIDE_EFFECTS (primop0))
+		return build2 (COMPOUND_EXPR, TREE_TYPE (value),
+			       primop0, value);
+	      return value;
+	    }
+	}
+    }
+
+  *op0_ptr = convert2 (type, primop0);
+  *op1_ptr = convert2 (type, primop1);
+
+  *restype_ptr = error_mark_node; /* truthvalue_type_node; */
+
+  return 0;
+}
+
+static tree
+common_truthvalue_conversion (tree expr);
+
+static tree
+build_binary_op2 (enum tree_code code, tree orig_op0, tree orig_op1,
+		 int convert_p ATTRIBUTE_UNUSED)
+{
+
+  /*<hack>*/
+  int skip_evaluation = 1;
+  /*<hack>*/
+
+  tree type0, type1;
+  enum tree_code code0, code1;
+  tree op0, op1;
+/*   const char *invalid_op_diag; */
+
+  /* Expression code to give to the expression when it is built.
+     Normally this is CODE, which is what the caller asked for,
+     but in some special cases we change it.  */
+  enum tree_code resultcode = code;
+
+  /* Data type in which the computation is to be performed.
+     In the simplest cases this is the common type of the arguments.  */
+  tree result_type = NULL;
+
+  /* Nonzero means operands have already been type-converted
+     in whatever way is necessary.
+     Zero means they need to be converted to RESULT_TYPE.  */
+  int converted = 0;
+
+  /* Nonzero means create the expression with this type, rather than
+     RESULT_TYPE.  */
+  tree build_type = 0;
+
+  /* Nonzero means after finally constructing the expression
+     convert it to this type.  */
+  tree final_type = 0;
+
+  /* Nonzero if this is an operation like MIN or MAX which can
+     safely be computed in short if both args are promoted shorts.
+     Also implies COMMON.
+     -1 indicates a bitwise operation; this makes a difference
+     in the exact conditions for when it is safe to do the operation
+     in a narrower mode.  */
+  int shorten = 0;
+
+  /* Nonzero if this is a comparison operation;
+     if both args are promoted shorts, compare the original shorts.
+     Also implies COMMON.  */
+  int short_compare = 0;
+
+  /* Nonzero if this is a right-shift operation, which can be computed on the
+     original short and then promoted if the operand is a promoted short.  */
+  int short_shift = 0;
+
+  /* Nonzero means set RESULT_TYPE to the common type of the args.  */
+  int common = 0;
+
+  /* True means types are compatible as far as ObjC is concerned.  */
+/*   bool objc_ok; */
+
+  if (convert_p)
+    {
+      op0 = default_conversion2 (orig_op0);
+      op1 = default_conversion2 (orig_op1);
+    }
+  else
+    {
+      op0 = orig_op0;
+      op1 = orig_op1;
+    }
+
+  type0 = TREE_TYPE (op0);
+  type1 = TREE_TYPE (op1);
+
+  /* The expression codes of the data types of the arguments tell us
+     whether the arguments are integers, floating, pointers, etc.  */
+  code0 = TREE_CODE (type0);
+  code1 = TREE_CODE (type1);
+
+  /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue.  */
+  STRIP_TYPE_NOPS (op0);
+  STRIP_TYPE_NOPS (op1);
+
+  /* If an error was already reported for one of the arguments,
+     avoid reporting another error.  */
+
+  if (code0 == ERROR_MARK || code1 == ERROR_MARK)
+    return error_mark_node;
+
+/*   if ((invalid_op_diag */
+/*        = targetm.invalid_binary_op (code, type0, type1))) */
+/*     { */
+/*       error (invalid_op_diag); */
+/*       return error_mark_node; */
+/*     } */
+
+/*   objc_ok = objc_compare_types (type0, type1, -3, NULL_TREE); */
+
+  switch (code)
+    {
+    case PLUS_EXPR:
+      /* Handle the pointer + int case.  */
+      if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
+	return error_mark_node;
+/* 	  pointer_int_sum (PLUS_EXPR, op0, op1); */
+      else if (code1 == POINTER_TYPE && code0 == INTEGER_TYPE)
+	return error_mark_node;
+/* 	  pointer_int_sum (PLUS_EXPR, op1, op0); */
+      else
+	common = 1;
+      break;
+
+    case MINUS_EXPR:
+      /* Subtraction of two similar pointers.
+	 We must subtract them as integers, then divide by object size.  */
+
+      if (code0 == POINTER_TYPE && code1 == POINTER_TYPE
+	  && 1)
+/* 	  comp_target_types (type0, type1)) */
+	return error_mark_node;
+      /* pointer_diff (op0, op1); */
+
+/*       Handle pointer minus int.  Just like pointer plus int. */
+      else   if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
+	return error_mark_node;
+/* 	  pointer_int_sum (MINUS_EXPR, op0, op1); */
+      else
+	common = 1;
+      break;
+
+    case MULT_EXPR:
+      common = 1;
+      break;
+
+    case TRUNC_DIV_EXPR:
+    case CEIL_DIV_EXPR:
+    case FLOOR_DIV_EXPR:
+    case ROUND_DIV_EXPR:
+    case EXACT_DIV_EXPR:
+      /* Floating point division by zero is a legitimate way to obtain
+	 infinities and NaNs.  */
+      if (skip_evaluation == 0 && integer_zerop (op1))
+	warning (OPT_Wdiv_by_zero, "division by zero");
+
+      if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE
+	   || code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE)
+	  && (code1 == INTEGER_TYPE || code1 == REAL_TYPE
+	      || code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE))
+	{
+	  enum tree_code tcode0 = code0, tcode1 = code1;
+
+	  if (code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE)
+	    tcode0 = TREE_CODE (TREE_TYPE (TREE_TYPE (op0)));
+	  if (code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE)
+	    tcode1 = TREE_CODE (TREE_TYPE (TREE_TYPE (op1)));
+
+	  if (!(tcode0 == INTEGER_TYPE && tcode1 == INTEGER_TYPE))
+	    resultcode = RDIV_EXPR;
+	  else
+	    /* Although it would be tempting to shorten always here, that
+	       loses on some targets, since the modulo instruction is
+	       undefined if the quotient can't be represented in the
+	       computation mode.  We shorten only if unsigned or if
+	       dividing by something we know != -1.  */
+	    shorten = (TYPE_UNSIGNED (TREE_TYPE (orig_op0))
+		       || (TREE_CODE (op1) == INTEGER_CST
+			   && !integer_all_onesp (op1)));
+	  common = 1;
+	}
+      break;
+
+    case BIT_AND_EXPR:
+    case BIT_IOR_EXPR:
+    case BIT_XOR_EXPR:
+      if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
+	shorten = -1;
+      else if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
+	common = 1;
+      break;
+
+    case TRUNC_MOD_EXPR:
+    case FLOOR_MOD_EXPR:
+      if (skip_evaluation == 0 && integer_zerop (op1))
+	warning (OPT_Wdiv_by_zero, "division by zero");
+
+      if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
+	{
+	  /* Although it would be tempting to shorten always here, that loses
+	     on some targets, since the modulo instruction is undefined if the
+	     quotient can't be represented in the computation mode.  We shorten
+	     only if unsigned or if dividing by something we know != -1.  */
+	  shorten = (TYPE_UNSIGNED (TREE_TYPE (orig_op0))
+		     || (TREE_CODE (op1) == INTEGER_CST
+			 && !integer_all_onesp (op1)));
+	  common = 1;
+	}
+      break;
+
+    case TRUTH_ANDIF_EXPR:
+    case TRUTH_ORIF_EXPR:
+    case TRUTH_AND_EXPR:
+    case TRUTH_OR_EXPR:
+    case TRUTH_XOR_EXPR:
+      if ((code0 == INTEGER_TYPE || code0 == POINTER_TYPE
+	   || code0 == REAL_TYPE || code0 == COMPLEX_TYPE)
+	  && (code1 == INTEGER_TYPE || code1 == POINTER_TYPE
+	      || code1 == REAL_TYPE || code1 == COMPLEX_TYPE))
+	{
+	  /* Result of these operations is always an int,
+	     but that does not mean the operands should be
+	     converted to ints!  */
+	  result_type = integer_type_node;
+	  op0 = common_truthvalue_conversion (op0);
+	  op1 = common_truthvalue_conversion (op1);
+	  converted = 1;
+	}
+      break;
+
+      /* Shift operations: result has same type as first operand;
+	 always convert second operand to int.
+	 Also set SHORT_SHIFT if shifting rightward.  */
+
+    case RSHIFT_EXPR:
+      if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
+	{
+	  if (TREE_CODE (op1) == INTEGER_CST && skip_evaluation == 0)
+	    {
+	      if (tree_int_cst_sgn (op1) < 0)
+		warning (0, "right shift count is negative");
+	      else
+		{
+		  if (!integer_zerop (op1))
+		    short_shift = 1;
+
+		  if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0)
+		    warning (0, "right shift count >= width of type");
+		}
+	    }
+
+	  /* Use the type of the value to be shifted.  */
+	  result_type = type0;
+	  /* Convert the shift-count to an integer, regardless of size
+	     of value being shifted.  */
+	  if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
+	    op1 = convert2 (integer_type_node, op1);
+	  /* Avoid converting op1 to result_type later.  */
+	  converted = 1;
+	}
+      break;
+
+    case LSHIFT_EXPR:
+      if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
+	{
+	  if (TREE_CODE (op1) == INTEGER_CST && skip_evaluation == 0)
+	    {
+	      if (tree_int_cst_sgn (op1) < 0)
+		warning (0, "left shift count is negative");
+
+	      else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0)
+		warning (0, "left shift count >= width of type");
+	    }
+
+	  /* Use the type of the value to be shifted.  */
+	  result_type = type0;
+	  /* Convert the shift-count to an integer, regardless of size
+	     of value being shifted.  */
+	  if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
+	    op1 = convert2 (integer_type_node, op1);
+	  /* Avoid converting op1 to result_type later.  */
+	  converted = 1;
+	}
+      break;
+
+    case EQ_EXPR:
+    case NE_EXPR:
+      if (code0 == REAL_TYPE || code1 == REAL_TYPE)
+	warning (OPT_Wfloat_equal,
+		 "comparing floating point with == or != is unsafe");
+      /* Result of comparison is always int,
+	 but don't convert the args to int!  */
+      build_type = integer_type_node;
+      if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE
+	   || code0 == COMPLEX_TYPE)
+	  && (code1 == INTEGER_TYPE || code1 == REAL_TYPE
+	      || code1 == COMPLEX_TYPE))
+	short_compare = 1;
+      else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
+	{
+	  tree tt0 = TREE_TYPE (type0);
+	  tree tt1 = TREE_TYPE (type1);
+	  /* Anything compares with void *.  void * compares with anything.
+	     Otherwise, the targets must be compatible
+	     and both must be object or both incomplete.  */
+/* 	  if (comp_target_types (type0, type1)) */
+/* 	    result_type = common_pointer_type (type0, type1); */
+/* 	  else */
+	    if (VOID_TYPE_P (tt0))
+	    {
+	      /* op0 != orig_op0 detects the case of something
+		 whose value is 0 but which isn't a valid null ptr const.  */
+/* 	      if (pedantic && !null_pointer_constant_p (orig_op0) */
+/* 		  && TREE_CODE (tt1) == FUNCTION_TYPE) */
+/* 		pedwarn ("ISO C forbids comparison of %<void *%>" */
+/* 			 " with function pointer"); */
+	    }
+	  else if (VOID_TYPE_P (tt1))
+	    {
+/* 	      if (pedantic && !null_pointer_constant_p (orig_op1) */
+/* 		  && TREE_CODE (tt0) == FUNCTION_TYPE) */
+/* 		pedwarn ("ISO C forbids comparison of %<void *%>" */
+/* 			 " with function pointer"); */
+	    }
+	  else
+	    /* Avoid warning about the volatile ObjC EH puts on decls.  */
+/* 	    if (!objc_ok) */
+/* 	      pedwarn ("comparison of distinct pointer types lacks a cast"); */
+
+	  if (result_type == NULL_TREE)
+	    result_type = ptr_type_node;
+	}
+/*       else if (code0 == POINTER_TYPE && null_pointer_constant_p (orig_op1)) */
+/* 	{ */
+/* 	  if (TREE_CODE (op0) == ADDR_EXPR */
+/* 	      && DECL_P (TREE_OPERAND (op0, 0))  */
+/* 	      && !DECL_WEAK (TREE_OPERAND (op0, 0))) */
+/* 	    warning (OPT_Walways_true, "the address of %qD will never be NULL", */
+/* 		     TREE_OPERAND (op0, 0)); */
+/* 	  result_type = type0; */
+/* 	} */
+/*       else if (code1 == POINTER_TYPE && null_pointer_constant_p (orig_op0)) */
+/* 	{ */
+/* 	  if (TREE_CODE (op1) == ADDR_EXPR  */
+/* 	      && DECL_P (TREE_OPERAND (op1, 0)) */
+/* 	      && !DECL_WEAK (TREE_OPERAND (op1, 0))) */
+/* 	    warning (OPT_Walways_true, "the address of %qD will never be NULL", */
+/* 		     TREE_OPERAND (op1, 0)); */
+/* 	  result_type = type1; */
+/* 	} */
+      else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
+	{
+	  result_type = type0;
+/* 	  pedwarn ("comparison between pointer and integer"); */
+	}
+      else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
+	{
+	  result_type = type1;
+/* 	  pedwarn ("comparison between pointer and integer"); */
+	}
+      break;
+
+    case LE_EXPR:
+    case GE_EXPR:
+    case LT_EXPR:
+    case GT_EXPR:
+      build_type = integer_type_node;
+      if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)
+	  && (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
+	short_compare = 1;
+      else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
+	{
+/* 	  if (comp_target_types (type0, type1)) */
+/* 	    { */
+/* 	      result_type = common_pointer_type (type0, type1); */
+/* 	      if (!COMPLETE_TYPE_P (TREE_TYPE (type0)) */
+/* 		  != !COMPLETE_TYPE_P (TREE_TYPE (type1))) */
+/* 		pedwarn ("comparison of complete and incomplete pointers"); */
+/* 	      else if (pedantic */
+/* 		       && TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE) */
+/* 		pedwarn ("ISO C forbids ordered comparisons of pointers to functions"); */
+/* 	    } */
+/* 	  else */
+	    {
+	      result_type = ptr_type_node;
+	      pedwarn ("comparison of distinct pointer types lacks a cast");
+	    }
+	}
+/*       else if (code0 == POINTER_TYPE && null_pointer_constant_p (orig_op1)) */
+/* 	{ */
+/* 	  result_type = type0; */
+/* 	  if (pedantic || extra_warnings) */
+/* 	    pedwarn ("ordered comparison of pointer with integer zero"); */
+/* 	} */
+/*       else if (code1 == POINTER_TYPE && null_pointer_constant_p (orig_op0)) */
+/* 	{ */
+/* 	  result_type = type1; */
+/* 	  if (pedantic) */
+/* 	    pedwarn ("ordered comparison of pointer with integer zero"); */
+/* 	} */
+      else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
+	{
+	  result_type = type0;
+	  pedwarn ("comparison between pointer and integer");
+	}
+      else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
+	{
+	  result_type = type1;
+	  pedwarn ("comparison between pointer and integer");
+	}
+      break;
+
+    default:
+      gcc_unreachable ();
+    }
+
+  if (code0 == ERROR_MARK || code1 == ERROR_MARK)
+    return error_mark_node;
+
+  if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE
+      && (!tree_int_cst_equal (TYPE_SIZE (type0), TYPE_SIZE (type1))
+	  || 0))
+/* 	  !same_scalar_type_ignoring_signedness (TREE_TYPE (type0), */
+/* 						    TREE_TYPE (type1)))) */
+    {
+/*       binary_op_error (code); */
+      return error_mark_node;
+    }
+
+  if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == COMPLEX_TYPE
+       || code0 == VECTOR_TYPE)
+      &&
+      (code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == COMPLEX_TYPE
+       || code1 == VECTOR_TYPE))
+    {
+      int none_complex = (code0 != COMPLEX_TYPE && code1 != COMPLEX_TYPE);
+
+      if (shorten || common || short_compare)
+	result_type = c_common_type (type0, type1);
+
+      /* For certain operations (which identify themselves by shorten != 0)
+	 if both args were extended from the same smaller type,
+	 do the arithmetic in that type and then extend.
+
+	 shorten !=0 and !=1 indicates a bitwise operation.
+	 For them, this optimization is safe only if
+	 both args are zero-extended or both are sign-extended.
+	 Otherwise, we might change the result.
+	 Eg, (short)-1 | (unsigned short)-1 is (int)-1
+	 but calculated in (unsigned short) it would be (unsigned short)-1.  */
+
+      if (shorten && none_complex)
+	{
+	  int unsigned0, unsigned1;
+	  tree arg0, arg1;
+	  int uns;
+	  tree type;
+
+	  /* Cast OP0 and OP1 to RESULT_TYPE.  Doing so prevents
+	     excessive narrowing when we call get_narrower below.  For
+	     example, suppose that OP0 is of unsigned int extended
+	     from signed char and that RESULT_TYPE is long long int.
+	     If we explicitly cast OP0 to RESULT_TYPE, OP0 would look
+	     like
+
+	       (long long int) (unsigned int) signed_char
+
+	     which get_narrower would narrow down to
+
+	       (unsigned int) signed char
+
+	     If we do not cast OP0 first, get_narrower would return
+	     signed_char, which is inconsistent with the case of the
+	     explicit cast.  */
+	  op0 = convert2 (result_type, op0);
+	  op1 = convert2 (result_type, op1);
+
+	  arg0 = get_narrower (op0, &unsigned0);
+	  arg1 = get_narrower (op1, &unsigned1);
+
+	  /* UNS is 1 if the operation to be done is an unsigned one.  */
+	  uns = TYPE_UNSIGNED (result_type);
+
+	  final_type = result_type;
+
+	  /* Handle the case that OP0 (or OP1) does not *contain* a conversion
+	     but it *requires* conversion to FINAL_TYPE.  */
+
+	  if ((TYPE_PRECISION (TREE_TYPE (op0))
+	       == TYPE_PRECISION (TREE_TYPE (arg0)))
+	      && TREE_TYPE (op0) != final_type)
+	    unsigned0 = TYPE_UNSIGNED (TREE_TYPE (op0));
+	  if ((TYPE_PRECISION (TREE_TYPE (op1))
+	       == TYPE_PRECISION (TREE_TYPE (arg1)))
+	      && TREE_TYPE (op1) != final_type)
+	    unsigned1 = TYPE_UNSIGNED (TREE_TYPE (op1));
+
+	  /* Now UNSIGNED0 is 1 if ARG0 zero-extends to FINAL_TYPE.  */
+
+	  /* For bitwise operations, signedness of nominal type
+	     does not matter.  Consider only how operands were extended.  */
+	  if (shorten == -1)
+	    uns = unsigned0;
+
+	  /* Note that in all three cases below we refrain from optimizing
+	     an unsigned operation on sign-extended args.
+	     That would not be valid.  */
+
+	  /* Both args variable: if both extended in same way
+	     from same width, do it in that width.
+	     Do it unsigned if args were zero-extended.  */
+	  if ((TYPE_PRECISION (TREE_TYPE (arg0))
+	       < TYPE_PRECISION (result_type))
+	      && (TYPE_PRECISION (TREE_TYPE (arg1))
+		  == TYPE_PRECISION (TREE_TYPE (arg0)))
+	      && unsigned0 == unsigned1
+	      && (unsigned0 || !uns))
+	    result_type
+	      = error_mark_node;
+	      /* c_common_signed_or_unsigned_type */
+/* 	      (unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1))); */
+	  else if (TREE_CODE (arg0) == INTEGER_CST
+		   && (unsigned1 || !uns)
+		   && (TYPE_PRECISION (TREE_TYPE (arg1))
+		       < TYPE_PRECISION (result_type))
+		   && (type
+		       = error_mark_node,
+/* 		       c_common_signed_or_unsigned_type (unsigned1, */
+/* 							   TREE_TYPE (arg1)), */
+		       int_fits_type_p (arg0, type)))
+	    result_type = type;
+	  else if (TREE_CODE (arg1) == INTEGER_CST
+		   && (unsigned0 || !uns)
+		   && (TYPE_PRECISION (TREE_TYPE (arg0))
+		       < TYPE_PRECISION (result_type))
+		   && (type
+		       = error_mark_node,
+/* 		       c_common_signed_or_unsigned_type (unsigned0, */
+/* 							   TREE_TYPE (arg0)), */
+		       int_fits_type_p (arg1, type)))
+	    result_type = type;
+	}
+
+      /* Shifts can be shortened if shifting right.  */
+
+      if (short_shift)
+	{
+	  int unsigned_arg;
+	  tree arg0 = get_narrower (op0, &unsigned_arg);
+
+	  final_type = result_type;
+
+	  if (arg0 == op0 && final_type == TREE_TYPE (op0))
+	    unsigned_arg = TYPE_UNSIGNED (TREE_TYPE (op0));
+
+	  if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type)
+	      /* We can shorten only if the shift count is less than the
+		 number of bits in the smaller type size.  */
+	      && compare_tree_int (op1, TYPE_PRECISION (TREE_TYPE (arg0))) < 0
+	      /* We cannot drop an unsigned shift after sign-extension.  */
+	      && (!TYPE_UNSIGNED (final_type) || unsigned_arg))
+	    {
+	      /* Do an unsigned shift if the operand was zero-extended.  */
+	      result_type
+		= error_mark_node;
+/* 		c_common_signed_or_unsigned_type (unsigned_arg, */
+/* 						    TREE_TYPE (arg0)); */
+	      /* Convert value-to-be-shifted to that type.  */
+	      if (TREE_TYPE (op0) != result_type)
+		op0 = convert2 (result_type, op0);
+	      converted = 1;
+	    }
+	}
+
+      /* Comparison operations are shortened too but differently.
+	 They identify themselves by setting short_compare = 1.  */
+
+      if (short_compare)
+	{
+	  /* Don't write &op0, etc., because that would prevent op0
+	     from being kept in a register.
+	     Instead, make copies of the our local variables and
+	     pass the copies by reference, then copy them back afterward.  */
+	  tree xop0 = op0, xop1 = op1, xresult_type = result_type;
+	  enum tree_code xresultcode = resultcode;
+	  tree val =
+	    shorten_compare2 (&xop0, &xop1, &xresult_type, &xresultcode);
+
+	  if (val != 0)
+	    return val;
+
+	  op0 = xop0, op1 = xop1;
+	  converted = 1;
+	  resultcode = xresultcode;
+
+	  if (warn_sign_compare && skip_evaluation == 0)
+	    {
+	      int op0_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op0));
+	      int op1_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op1));
+	      int unsignedp0, unsignedp1;
+	      tree primop0 = get_narrower (op0, &unsignedp0);
+	      tree primop1 = get_narrower (op1, &unsignedp1);
+
+	      xop0 = orig_op0;
+	      xop1 = orig_op1;
+	      STRIP_TYPE_NOPS (xop0);
+	      STRIP_TYPE_NOPS (xop1);
+
+	      /* Give warnings for comparisons between signed and unsigned
+		 quantities that may fail.
+
+		 Do the checking based on the original operand trees, so that
+		 casts will be considered, but default promotions won't be.
+
+		 Do not warn if the comparison is being done in a signed type,
+		 since the signed type will only be chosen if it can represent
+		 all the values of the unsigned type.  */
+	      if (!TYPE_UNSIGNED (result_type))
+		/* OK */;
+              /* Do not warn if both operands are the same signedness.  */
+              else if (op0_signed == op1_signed)
+                /* OK */;
+	      else
+		{
+		  tree sop, uop;
+
+		  if (op0_signed)
+		    sop = xop0, uop = xop1;
+		  else
+		    sop = xop1, uop = xop0;
+
+		  /* Do not warn if the signed quantity is an
+		     unsuffixed integer literal (or some static
+		     constant expression involving such literals or a
+		     conditional expression involving such literals)
+		     and it is non-negative.  */
+		  if (tree_expr_nonnegative_p (sop))
+		    /* OK */;
+		  /* Do not warn if the comparison is an equality operation,
+		     the unsigned quantity is an integral constant, and it
+		     would fit in the result if the result were signed.  */
+		  else if (TREE_CODE (uop) == INTEGER_CST
+			   && (resultcode == EQ_EXPR || resultcode == NE_EXPR)
+			   && int_fits_type_p
+			   (uop, error_mark_node))
+			    /* c_common_signed_type (result_type))) */
+		    /* OK */;
+		  /* Do not warn if the unsigned quantity is an enumeration
+		     constant and its maximum value would fit in the result
+		     if the result were signed.  */
+		  else if (TREE_CODE (uop) == INTEGER_CST
+			   && TREE_CODE (TREE_TYPE (uop)) == ENUMERAL_TYPE
+			   && int_fits_type_p
+			   (TYPE_MAX_VALUE (TREE_TYPE (uop)),
+			    error_mark_node))
+/* 			    c_common_signed_type (result_type))) */
+		    /* OK */;
+		  else
+		    warning (0, "comparison between signed and unsigned");
+		}
+
+	      /* Warn if two unsigned values are being compared in a size
+		 larger than their original size, and one (and only one) is the
+		 result of a `~' operator.  This comparison will always fail.
+
+		 Also warn if one operand is a constant, and the constant
+		 does not have all bits set that are set in the ~ operand
+		 when it is extended.  */
+
+	      if ((TREE_CODE (primop0) == BIT_NOT_EXPR)
+		  != (TREE_CODE (primop1) == BIT_NOT_EXPR))
+		{
+		  if (TREE_CODE (primop0) == BIT_NOT_EXPR)
+		    primop0 = get_narrower (TREE_OPERAND (primop0, 0),
+					    &unsignedp0);
+		  else
+		    primop1 = get_narrower (TREE_OPERAND (primop1, 0),
+					    &unsignedp1);
+
+		  if (host_integerp (primop0, 0) || host_integerp (primop1, 0))
+		    {
+		      tree primop;
+		      HOST_WIDE_INT constant, mask;
+		      int unsignedp, bits;
+
+		      if (host_integerp (primop0, 0))
+			{
+			  primop = primop1;
+			  unsignedp = unsignedp1;
+			  constant = tree_low_cst (primop0, 0);
+			}
+		      else
+			{
+			  primop = primop0;
+			  unsignedp = unsignedp0;
+			  constant = tree_low_cst (primop1, 0);
+			}
+
+		      bits = TYPE_PRECISION (TREE_TYPE (primop));
+		      if (bits < TYPE_PRECISION (result_type)
+			  && bits < HOST_BITS_PER_WIDE_INT && unsignedp)
+			{
+			  mask = (~(HOST_WIDE_INT) 0) << bits;
+			  if ((mask & constant) != mask)
+			    warning (0, "comparison of promoted ~unsigned with constant");
+			}
+		    }
+		  else if (unsignedp0 && unsignedp1
+			   && (TYPE_PRECISION (TREE_TYPE (primop0))
+			       < TYPE_PRECISION (result_type))
+			   && (TYPE_PRECISION (TREE_TYPE (primop1))
+			       < TYPE_PRECISION (result_type)))
+		    warning (0, "comparison of promoted ~unsigned with unsigned");
+		}
+	    }
+	}
+    }
+
+  /* At this point, RESULT_TYPE must be nonzero to avoid an error message.
+     If CONVERTED is zero, both args will be converted to type RESULT_TYPE.
+     Then the expression will be built.
+     It will be given type FINAL_TYPE if that is nonzero;
+     otherwise, it will be given type RESULT_TYPE.  */
+
+  if (!result_type)
+    {
+/*       binary_op_error (code); */
+      return error_mark_node;
+    }
+
+  if (!converted)
+    {
+      if (TREE_TYPE (op0) != result_type)
+	op0 = convert2 (result_type, op0);
+      if (TREE_TYPE (op1) != result_type)
+	op1 = convert2 (result_type, op1);
+
+      /* This can happen if one operand has a vector type, and the other
+	 has a different type.  */
+      if (TREE_CODE (op0) == ERROR_MARK || TREE_CODE (op1) == ERROR_MARK)
+	return error_mark_node;
+    }
+
+  if (build_type == NULL_TREE)
+    build_type = result_type;
+
+  {
+    /* Treat expressions in initializers specially as they can't trap.  */
+    int require_constant_value = 0;
+    tree result = require_constant_value ? fold_build2_initializer (resultcode,
+								    build_type,
+								    op0, op1)
+					 : fold_build2 (resultcode, build_type,
+							op0, op1);
+
+    if (final_type != 0)
+      result = convert2 (final_type, result);
+    return result;
+  }
+}
+
+/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
+   or for an `if' or `while' statement or ?..: exp.  It should already
+   have been validated to be of suitable type; otherwise, a bad
+   diagnostic may result.
+
+   This preparation consists of taking the ordinary
+   representation of an expression expr and producing a valid tree
+   boolean expression describing whether expr is nonzero.  We could
+   simply always do build_binary_op (NE_EXPR, expr, integer_zero_node, 1),
+   but we optimize comparisons, &&, ||, and !.
+
+   The resulting type should always be `truthvalue_type_node'.  */
+
+static tree
+common_truthvalue_conversion2 (tree expr)
+{
+
+  switch (TREE_CODE (expr))
+    {
+    case EQ_EXPR:   case NE_EXPR:   case UNEQ_EXPR: case LTGT_EXPR:
+    case LE_EXPR:   case GE_EXPR:   case LT_EXPR:   case GT_EXPR:
+    case UNLE_EXPR: case UNGE_EXPR: case UNLT_EXPR: case UNGT_EXPR:
+    case ORDERED_EXPR: case UNORDERED_EXPR:
+      if (TREE_TYPE (expr) == integer_type_node)
+	return expr;
+      return build2 (TREE_CODE (expr), integer_type_node,
+		     TREE_OPERAND (expr, 0), TREE_OPERAND (expr, 1));
+
+    case TRUTH_ANDIF_EXPR:
+    case TRUTH_ORIF_EXPR:
+    case TRUTH_AND_EXPR:
+    case TRUTH_OR_EXPR:
+    case TRUTH_XOR_EXPR:
+      if (TREE_TYPE (expr) == integer_type_node)
+	return expr;
+      return build2 (TREE_CODE (expr), integer_type_node,
+		 common_truthvalue_conversion2 (TREE_OPERAND (expr, 0)),
+		 common_truthvalue_conversion2 (TREE_OPERAND (expr, 1)));
+
+    case TRUTH_NOT_EXPR:
+      if (TREE_TYPE (expr) == integer_type_node)
+	return expr;
+      return build1 (TREE_CODE (expr), integer_type_node,
+		 common_truthvalue_conversion2 (TREE_OPERAND (expr, 0)));
+
+    case ERROR_MARK:
+      return expr;
+
+    case INTEGER_CST:
+      /* Avoid integer_zerop to ignore TREE_CONSTANT_OVERFLOW.  */
+      return (TREE_INT_CST_LOW (expr) != 0 || TREE_INT_CST_HIGH (expr) != 0)
+	     ? integer_one_node
+	     : integer_zero_node;
+
+    case REAL_CST:
+      return real_compare (NE_EXPR, &TREE_REAL_CST (expr), &dconst0)
+	     ? integer_one_node
+	     : integer_zero_node;
+
+/*     case FUNCTION_DECL: */
+/*       expr = build_unary_op (ADDR_EXPR, expr, 0); */
+      /* Fall through.  */
+
+    case ADDR_EXPR:
+      {
+ 	tree inner = TREE_OPERAND (expr, 0);
+	if (DECL_P (inner)
+	    && (TREE_CODE (inner) == PARM_DECL || !DECL_WEAK (inner)))
+	  {
+	    /* Common Ada/Pascal programmer's mistake.  We always warn
+	       about this since it is so bad.  */
+	    warning (OPT_Walways_true, "the address of %qD, will always evaluate as %<true%>",
+		     inner);
+	    return integer_one_node;
+	  }
+
+	/* If we are taking the address of an external decl, it might be
+	   zero if it is weak, so we cannot optimize.  */
+	if (DECL_P (inner)
+	    && DECL_EXTERNAL (inner))
+	  break;
+
+	if (TREE_SIDE_EFFECTS (inner))
+	  return build2 (COMPOUND_EXPR, integer_type_node,
+			 inner, integer_one_node);
+	else
+	  return integer_one_node;
+      }
+
+/*     case COMPLEX_EXPR: */
+/*       return build_binary_op ((TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1)) */
+/* 			       ? TRUTH_OR_EXPR : TRUTH_ORIF_EXPR), */
+/* 		common_truthvalue_conversion2 (TREE_OPERAND (expr, 0)), */
+/* 		common_truthvalue_conversion2 (TREE_OPERAND (expr, 1)), */
+/* 			      0); */
+
+    case NEGATE_EXPR:
+    case ABS_EXPR:
+    case FLOAT_EXPR:
+      /* These don't change whether an object is nonzero or zero.  */
+      return common_truthvalue_conversion2 (TREE_OPERAND (expr, 0));
+
+    case LROTATE_EXPR:
+    case RROTATE_EXPR:
+      /* These don't change whether an object is zero or nonzero, but
+	 we can't ignore them if their second arg has side-effects.  */
+      if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1)))
+	return build2 (COMPOUND_EXPR, integer_type_node,
+		       TREE_OPERAND (expr, 1),
+		       common_truthvalue_conversion2 (TREE_OPERAND (expr, 0)));
+      else
+	return common_truthvalue_conversion2 (TREE_OPERAND (expr, 0));
+
+    case COND_EXPR:
+      /* Distribute the conversion into the arms of a COND_EXPR.  */
+      return fold_build3 (COND_EXPR, integer_type_node,
+		TREE_OPERAND (expr, 0),
+		common_truthvalue_conversion2 (TREE_OPERAND (expr, 1)),
+		common_truthvalue_conversion2 (TREE_OPERAND (expr, 2)));
+
+    case CONVERT_EXPR:
+    case NOP_EXPR:
+      /* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE,
+	 since that affects how `default_conversion' will behave.  */
+      if (TREE_CODE (TREE_TYPE (expr)) == REFERENCE_TYPE
+	  || TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == REFERENCE_TYPE)
+	break;
+      /* If this is widening the argument, we can ignore it.  */
+      if (TYPE_PRECISION (TREE_TYPE (expr))
+	  >= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (expr, 0))))
+	return common_truthvalue_conversion2 (TREE_OPERAND (expr, 0));
+      break;
+
+    case MODIFY_EXPR:
+      if (!TREE_NO_WARNING (expr))
+	warning (OPT_Wparentheses,
+		 "suggest parentheses around assignment used as truth value");
+      break;
+
+    default:
+      break;
+    }
+
+  if (TREE_CODE (TREE_TYPE (expr)) == COMPLEX_TYPE)
+    {
+      return error_mark_node;
+/*       tree t = save_expr (expr); */
+/*       return (build_binary_op */
+/* 	      ((TREE_SIDE_EFFECTS (expr) */
+/* 		? TRUTH_OR_EXPR : TRUTH_ORIF_EXPR), */
+/* 	common_truthvalue_conversion2 (build_unary_op (REALPART_EXPR, t, 0)), */
+/* 	common_truthvalue_conversion2 (build_unary_op (IMAGPART_EXPR, t, 0)), */
+/* 	       0)); */
+    }
+
+  {
+/*     enum tree_code code = TREE_CODE(expr); */
+/*     if (code == CALL_EXPR) */
+/*       return error_mark_node; */
+/*     if (code == PARM_DECL) */
+/*       return error_mark_node; */
+/*     if (code == VAR_DECL) */
+/*       return error_mark_node; */
+/*     if (code == ARRAY_REF) */
+/*       return error_mark_node; */
+/*     if (code == COMPONENT_REF) */
+/*       return error_mark_node; */
+/*     if (code == BIT_AND_EXPR) */
+/*       return error_mark_node; */
+/*     if (code == COMPOUND_EXPR) */
+/*       return error_mark_node; */
+  }
+/*   printf("\n\n"); */
+/*   debug_tree(expr); */
+/*   printf("\n\n"); */
+
+  return build_binary_op2 (NE_EXPR, expr, integer_zero_node, 1);
+}
+
+/* Convert EXPR to be a truth-value, validating its type for this
+   purpose.  */
+
+static tree
+common_truthvalue_conversion (tree expr)
+{
+  switch (TREE_CODE (TREE_TYPE (expr)))
+    {
+    case ARRAY_TYPE:
+      error ("used array that cannot be converted to pointer where scalar is required");
+      return error_mark_node;
+
+    case RECORD_TYPE:
+      error ("used struct type value where scalar is required");
+      return error_mark_node;
+
+    case UNION_TYPE:
+      error ("used union type value where scalar is required");
+      return error_mark_node;
+
+    case FUNCTION_TYPE:
+      gcc_unreachable ();
+
+    default:
+      break;
+    }
+
+  /* ??? Should we also give an error for void and vectors rather than
+     leaving those to give errors later?  */
+  return common_truthvalue_conversion2 (expr);
+}
+
+tree
+convert2 (tree type, tree expr)
+{
+  tree e = expr;
+  enum tree_code code = TREE_CODE (type);
+  /*  const char *invalid_conv_diag; */
+
+  if (type == error_mark_node
+      || expr == error_mark_node
+      || TREE_TYPE (expr) == error_mark_node)
+    return error_mark_node;
+
+/*   if ((invalid_conv_diag */
+/*        = targetm.invalid_conversion (TREE_TYPE (expr), type))) */
+/*     { */
+/*       error (invalid_conv_diag); */
+/*       return error_mark_node; */
+/*     } */
+
+  if (type == TREE_TYPE (expr))
+    return expr;
+
+  if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr)))
+    return fold_convert (type, expr);
+  if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK)
+    return error_mark_node;
+  if (TREE_CODE (TREE_TYPE (expr)) == VOID_TYPE)
+    {
+      error ("void value not ignored as it ought to be");
+      return error_mark_node;
+    }
+  if (code == VOID_TYPE)
+    return fold_convert (type, e);
+  if (code == INTEGER_TYPE || code == ENUMERAL_TYPE)
+    return fold (convert_to_integer (type, e));
+  if (code == BOOLEAN_TYPE) {
+    tree aux = common_truthvalue_conversion (expr);
+    if (aux != error_mark_node)
+      return fold_convert (type, aux);
+  }
+  if (code == POINTER_TYPE || code == REFERENCE_TYPE)
+    return fold (convert_to_pointer (type, e));
+  if (code == REAL_TYPE)
+    return fold (convert_to_real (type, e));
+  if (code == COMPLEX_TYPE)
+    return fold (convert_to_complex (type, e));
+  if (code == VECTOR_TYPE)
+    return fold (convert_to_vector (type, e));
+  if ((code == RECORD_TYPE || code == UNION_TYPE)
+      && lang_hooks.types_compatible_p (type, TREE_TYPE (expr)))
+      return e;
+
+  error ( "conversion to non-scalar type requested");
+  return error_mark_node;
+}
Index: gcc/c-typeck.c
===================================================================
--- gcc/c-typeck.c	(revision 111978)
+++ gcc/c-typeck.c	(working copy)
@@ -1446,7 +1446,7 @@
   ptrtype = build_pointer_type (restype);
 
   if (TREE_CODE (exp) == INDIRECT_REF)
-    return convert (ptrtype, TREE_OPERAND (exp, 0));
+    return c_convert_internal (ptrtype, TREE_OPERAND (exp, 0));
 
   if (TREE_CODE (exp) == VAR_DECL)
     {
@@ -1464,7 +1464,7 @@
   /* This way is better for a COMPONENT_REF since it can
      simplify the offset for a component.  */
   adr = build_unary_op (ADDR_EXPR, exp, 1);
-  return convert (ptrtype, adr);
+  return c_convert_internal (ptrtype, adr);
 }
 
 /* Convert the function expression EXP to a pointer.  */
@@ -1540,7 +1540,33 @@
   return exp;
 }
 
+static bool
+c_promoting_integer_type_p2 (tree t)
+{
+  switch (TREE_CODE (t))
+    {
+    case INTEGER_TYPE:
+      return (TYPE_MAIN_VARIANT (t) == char_type_node
+	      || TYPE_MAIN_VARIANT (t) == signed_char_type_node
+	      || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node
+	      || TYPE_MAIN_VARIANT (t) == short_integer_type_node
+	      || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node
+	      || TYPE_PRECISION (t) < TYPE_PRECISION (integer_type_node));
 
+    case ENUMERAL_TYPE:
+      /* ??? Technically all enumerations not larger than an int
+	 promote to an int.  But this is used along code paths
+	 that only want to notice a size change.  */
+      return TYPE_PRECISION (t) < TYPE_PRECISION (integer_type_node);
+
+    case BOOLEAN_TYPE:
+      return 1;
+
+    default:
+      return 0;
+    }
+}
+
 /* EXP is an expression of integer type.  Apply the integer promotions
    to it and return the promoted value.  */
 
@@ -1562,7 +1588,7 @@
 				       >= TYPE_PRECISION (integer_type_node))
 				      && TYPE_UNSIGNED (type)));
 
-      return convert (type, exp);
+      return c_convert_internal (type, exp);
     }
 
   /* ??? This should no longer be needed now bit-fields have their
@@ -1573,16 +1599,16 @@
 	 c_promoting_integer_type_p, otherwise leave it alone.  */
       && 0 > compare_tree_int (DECL_SIZE (TREE_OPERAND (exp, 1)),
 			       TYPE_PRECISION (integer_type_node)))
-    return convert (integer_type_node, exp);
+    return c_convert_internal (integer_type_node, exp);
 
-  if (c_promoting_integer_type_p (type))
+  if (c_promoting_integer_type_p2 (type))
     {
       /* Preserve unsignedness if not really getting any wider.  */
       if (TYPE_UNSIGNED (type)
 	  && TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
-	return convert (unsigned_type_node, exp);
+	return c_convert_internal (unsigned_type_node, exp);
 
-      return convert (integer_type_node, exp);
+      return c_convert_internal (integer_type_node, exp);
     }
 
   return exp;
@@ -2483,7 +2509,7 @@
 	           < TYPE_PRECISION (double_type_node))
 	       && !DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (val))))
 	/* Convert `float' to `double'.  */
-	result = tree_cons (NULL_TREE, convert (double_type_node, val), result);
+	result = tree_cons (NULL_TREE, c_convert_internal (double_type_node, val), result);
       else if ((invalid_func_diag = 
 	        targetm.calls.invalid_arg_for_unprototyped_fn (typelist, fundecl, val)))
 	{
@@ -2705,8 +2731,8 @@
      Do not do default conversions on the minus operator
      in case restype is a short type.  */
 
-  op0 = build_binary_op (MINUS_EXPR, convert (restype, op0),
-			 convert (restype, op1), 0);
+  op0 = build_binary_op (MINUS_EXPR, c_convert_internal (restype, op0),
+			 c_convert_internal (restype, op1), 0);
   /* This generates an error if op1 is pointer to incomplete type.  */
   if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (orig_op1))))
     error ("arithmetic on pointer to an incomplete type");
@@ -2715,7 +2741,7 @@
   op1 = c_size_in_bytes (target_type);
 
   /* Divide by the size, in easiest possible way.  */
-  return fold_build2 (EXACT_DIV_EXPR, restype, op0, convert (restype, op1));
+  return fold_build2 (EXACT_DIV_EXPR, restype, op0, c_convert_internal (restype, op1));
 }
 
 /* Construct and perhaps optimize a tree representation
@@ -2848,7 +2874,7 @@
       else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE)
 	return fold_build1 (IMAGPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg);
       else
-	return convert (TREE_TYPE (arg), integer_zero_node);
+	return c_convert_internal (TREE_TYPE (arg), integer_zero_node);
 
     case PREINCREMENT_EXPR:
     case POSTINCREMENT_EXPR:
@@ -2920,7 +2946,7 @@
 	else
 	  inc = integer_one_node;
 
-	inc = convert (argtype, inc);
+	inc = c_convert_internal (argtype, inc);
 
 	/* Complain about anything else that is not a true lvalue.  */
 	if (!lvalue_or_else (arg, ((code == PREINCREMENT_EXPR
@@ -2944,7 +2970,7 @@
 	else
 	  val = build2 (code, TREE_TYPE (arg), arg, inc);
 	TREE_SIDE_EFFECTS (val) = 1;
-	val = convert (result_type, val);
+	val = c_convert_internal (result_type, val);
 	if (TREE_CODE (val) != code)
 	  TREE_NO_WARNING (val) = 1;
 	return val;
@@ -3560,7 +3586,7 @@
 	pedwarn ("ISO C forbids conversion of object pointer to function pointer type");
 
       ovalue = value;
-      value = convert (type, value);
+      value = c_convert_internal (type, value);
 
       /* Ignore any integer overflow caused by the cast.  */
       if (TREE_CODE (value) == INTEGER_CST)
@@ -3855,7 +3881,7 @@
   /* Some types can interconvert without explicit casts.  */
   else if (codel == VECTOR_TYPE && coder == VECTOR_TYPE
            && vector_types_convertible_p (type, TREE_TYPE (rhs)))
-    return convert (type, rhs);
+    return c_convert_internal (type, rhs);
   /* Arithmetic types all interconvert, and enum is treated like int.  */
   else if ((codel == INTEGER_TYPE || codel == REAL_TYPE
 	    || codel == ENUMERAL_TYPE || codel == COMPLEX_TYPE
@@ -4126,7 +4152,7 @@
 				  "pointer type"),
 			       G_("return from incompatible pointer type"));
 
-      return convert (type, rhs);
+      return c_convert_internal (type, rhs);
     }
   else if (codel == POINTER_TYPE && coder == ARRAY_TYPE)
     {
@@ -4150,7 +4176,7 @@
 			     G_("return makes pointer from integer "
 				"without a cast"));
 
-      return convert (type, rhs);
+      return c_convert_internal (type, rhs);
     }
   else if (codel == INTEGER_TYPE && coder == POINTER_TYPE)
     {
@@ -4162,10 +4188,10 @@
 			      "without a cast"),
 			   G_("return makes integer from pointer "
 			      "without a cast"));
-      return convert (type, rhs);
+      return c_convert_internal (type, rhs);
     }
   else if (codel == BOOLEAN_TYPE && coder == POINTER_TYPE)
-    return convert (type, rhs);
+    return c_convert_internal (type, rhs);
 
   switch (errtype)
     {
@@ -4637,7 +4663,7 @@
       if (code == VECTOR_TYPE)
 	/* Although the types are compatible, we may require a
 	   conversion.  */
-	inside_init = convert (type, inside_init);
+	inside_init = c_convert_internal (type, inside_init);
 
       if (require_constant && !flag_isoc99
 	  && TREE_CODE (inside_init) == COMPOUND_LITERAL_EXPR)
@@ -5066,7 +5092,7 @@
 	    constructor_max_index = build_int_cst (NULL_TREE, -1);
 
 	  constructor_index
-	    = convert (bitsizetype,
+	    = c_convert_internal (bitsizetype,
 		       TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type)));
 	}
       else
@@ -5082,7 +5108,7 @@
       /* Vectors are like simple fixed-size arrays.  */
       constructor_max_index =
 	build_int_cst (NULL_TREE, TYPE_VECTOR_SUBPARTS (constructor_type) - 1);
-      constructor_index = convert (bitsizetype, bitsize_zero_node);
+      constructor_index = c_convert_internal (bitsizetype, bitsize_zero_node);
       constructor_unfilled_index = constructor_index;
     }
   else
@@ -5245,7 +5271,7 @@
       /* Vectors are like simple fixed-size arrays.  */
       constructor_max_index =
 	build_int_cst (NULL_TREE, TYPE_VECTOR_SUBPARTS (constructor_type) - 1);
-      constructor_index = convert (bitsizetype, integer_zero_node);
+      constructor_index = c_convert_internal (bitsizetype, integer_zero_node);
       constructor_unfilled_index = constructor_index;
     }
   else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
@@ -5268,7 +5294,7 @@
 	    constructor_max_index = build_int_cst (NULL_TREE, -1);
 
 	  constructor_index
-	    = convert (bitsizetype,
+	    = c_convert_internal (bitsizetype,
 		       TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type)));
 	}
       else
@@ -5571,7 +5597,7 @@
     error_init ("array index in initializer exceeds array bounds");
   else
     {
-      constructor_index = convert (bitsizetype, first);
+      constructor_index = c_convert_internal (bitsizetype, first);
 
       if (last)
 	{
@@ -5584,7 +5610,7 @@
 	    }
 	  else
 	    {
-	      last = convert (bitsizetype, last);
+	      last = c_convert_internal (bitsizetype, last);
 	      if (constructor_max_index != 0
 		  && tree_int_cst_lt (constructor_max_index, last))
 		{
@@ -5885,7 +5911,7 @@
     {
       if (TYPE_DOMAIN (constructor_type))
 	constructor_unfilled_index
-	    = convert (bitsizetype,
+	    = c_convert_internal (bitsizetype,
 		       TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type)));
       else
 	constructor_unfilled_index = bitsize_zero_node;
@@ -6874,7 +6900,7 @@
 {
   if (pedantic)
     pedwarn ("ISO C forbids %<goto *expr;%>");
-  expr = convert (ptr_type_node, expr);
+  expr = c_convert_internal (ptr_type_node, expr);
   return add_stmt (build1 (GOTO_EXPR, void_type_node, expr));
 }
 
@@ -6918,7 +6944,7 @@
       if (t == error_mark_node)
 	return NULL_TREE;
 
-      inner = t = convert (TREE_TYPE (res), t);
+      inner = t = c_convert_internal (TREE_TYPE (res), t);
 
       /* Strip any conversions, additions, and subtractions, and see if
 	 we are returning the address of a local variable.  Warn if so.  */
@@ -7905,7 +7931,7 @@
 	  /* Convert the shift-count to an integer, regardless of size
 	     of value being shifted.  */
 	  if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
-	    op1 = convert (integer_type_node, op1);
+	    op1 = c_convert_internal (integer_type_node, op1);
 	  /* Avoid converting op1 to result_type later.  */
 	  converted = 1;
 	}
@@ -7928,7 +7954,7 @@
 	  /* Convert the shift-count to an integer, regardless of size
 	     of value being shifted.  */
 	  if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
-	    op1 = convert (integer_type_node, op1);
+	    op1 = c_convert_internal (integer_type_node, op1);
 	  /* Avoid converting op1 to result_type later.  */
 	  converted = 1;
 	}
@@ -8121,8 +8147,8 @@
 	     If we do not cast OP0 first, get_narrower would return
 	     signed_char, which is inconsistent with the case of the
 	     explicit cast.  */
-	  op0 = convert (result_type, op0);
-	  op1 = convert (result_type, op1);
+	  op0 = c_convert_internal (result_type, op0);
+	  op1 = c_convert_internal (result_type, op1);
 
 	  arg0 = get_narrower (op0, &unsigned0);
 	  arg1 = get_narrower (op1, &unsigned1);
@@ -8212,7 +8238,7 @@
 						    TREE_TYPE (arg0));
 	      /* Convert value-to-be-shifted to that type.  */
 	      if (TREE_TYPE (op0) != result_type)
-		op0 = convert (result_type, op0);
+		op0 = c_convert_internal (result_type, op0);
 	      converted = 1;
 	    }
 	}
@@ -8374,9 +8400,9 @@
   if (!converted)
     {
       if (TREE_TYPE (op0) != result_type)
-	op0 = convert (result_type, op0);
+	op0 = c_convert_internal (result_type, op0);
       if (TREE_TYPE (op1) != result_type)
-	op1 = convert (result_type, op1);
+	op1 = c_convert_internal (result_type, op1);
 
       /* This can happen if one operand has a vector type, and the other
 	 has a different type.  */
@@ -8396,7 +8422,7 @@
 							op0, op1);
 
     if (final_type != 0)
-      result = convert (final_type, result);
+      result = c_convert_internal (final_type, result);
     return result;
   }
 }
Index: gcc/treelang/treelang.h
===================================================================
--- gcc/treelang/treelang.h	(revision 111978)
+++ gcc/treelang/treelang.h	(working copy)
@@ -155,3 +155,5 @@
 void treelang_debug (void);
 
 void sanity_check (struct prod_token_parm_item *item);
+
+tree treelang_convert (tree type, tree expr);
Index: gcc/treelang/tree-convert.c
===================================================================
--- gcc/treelang/tree-convert.c	(revision 111978)
+++ gcc/treelang/tree-convert.c	(working copy)
@@ -35,6 +35,7 @@
 #include "convert.h"
 #include "toplev.h"
 #include "langhooks.h"
+#include "treelang.h"
 
 /* Change of width--truncation and extension of integers or reals--
    is represented with NOP_EXPR.  Proper functioning of many things
@@ -59,49 +60,3 @@
    conversions; callers should filter out those that are
    not permitted by the language being compiled.  */
 
-tree
-convert (tree type, tree expr)
-{
-  tree e = expr;
-  enum tree_code code = TREE_CODE (type);
-
-  if (type == TREE_TYPE (expr)
-      || TREE_CODE (expr) == ERROR_MARK
-      || code == ERROR_MARK || TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK)
-    return expr;
-
-  if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr)))
-    return fold_build1 (NOP_EXPR, type, expr);
-  if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK)
-    return error_mark_node;
-  if (TREE_CODE (TREE_TYPE (expr)) == VOID_TYPE)
-    {
-      error ("void value not ignored as it ought to be");
-      return error_mark_node;
-    }
-  if (code == VOID_TYPE)
-    return build1 (CONVERT_EXPR, type, e);
-  if (code == INTEGER_TYPE || code == ENUMERAL_TYPE)
-    return fold (convert_to_integer (type, e));
-  if (code == BOOLEAN_TYPE)
-    {
-      tree t = expr;
-      /* If it returns a NOP_EXPR, we must fold it here to avoid
-	 infinite recursion between fold () and convert ().  */
-      if (TREE_CODE (t) == NOP_EXPR)
-	return fold_build1 (NOP_EXPR, type, TREE_OPERAND (t, 0));
-      else
-	return fold_build1 (NOP_EXPR, type, t);
-    }
-  if (code == POINTER_TYPE || code == REFERENCE_TYPE)
-    return fold (convert_to_pointer (type, e));
-  if (code == REAL_TYPE)
-    return fold (convert_to_real (type, e));
-  if (code == COMPLEX_TYPE)
-    return fold (convert_to_complex (type, e));
-  if (code == VECTOR_TYPE)
-    return fold (convert_to_vector (type, e));
-
-  error ("conversion to non-scalar type requested");
-  return error_mark_node;
-}
Index: gcc/treelang/Make-lang.in
===================================================================
--- gcc/treelang/Make-lang.in	(revision 111978)
+++ gcc/treelang/Make-lang.in	(working copy)
@@ -110,7 +110,8 @@
   treelang/treetree.h treelang/parse.h
 
 treelang/tree-convert.o: treelang/tree-convert.c $(CONFIG_H) $(SYSTEM_H) \
-  coretypes.h diagnostic.h $(TREE_H) flags.h toplev.h langhooks.h $(TM_H)
+  coretypes.h diagnostic.h $(TREE_H) flags.h toplev.h langhooks.h $(TM_H) \
+  treelang/treelang.h
 
 treelang/spec.o: treelang/spec.c $(CONFIG_H) $(SYSTEM_H) \
   coretypes.h diagnostic.h $(TREE_H) flags.h toplev.h langhooks.h $(TM_H)
Index: gcc/gimplify.c
===================================================================
--- gcc/gimplify.c	(revision 111978)
+++ gcc/gimplify.c	(working copy)
@@ -2325,7 +2325,7 @@
     default:
       /* Other expressions that get here must have boolean values, but
 	 might need to be converted to the appropriate mode.  */
-      return convert (boolean_type_node, expr);
+      return convert2 (boolean_type_node, expr);
     }
 }
 
@@ -3027,7 +3027,7 @@
 	i = VEC_index (constructor_elt, elts, 1)->value;
 	if (r == NULL || i == NULL)
 	  {
-	    tree zero = convert (TREE_TYPE (type), integer_zero_node);
+	    tree zero = convert2 (TREE_TYPE (type), integer_zero_node);
 	    if (r == NULL)
 	      r = zero;
 	    if (i == NULL)
@@ -3530,8 +3530,8 @@
   tree type = TREE_TYPE (*expr_p);
 
   *expr_p = build3 (COND_EXPR, type, *expr_p,
-		    convert (type, boolean_true_node),
-		    convert (type, boolean_false_node));
+		    convert2 (type, boolean_true_node),
+		    convert2 (type, boolean_false_node));
 
   return GS_OK;
 }
Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c	(revision 111978)
+++ gcc/emit-rtl.c	(working copy)
@@ -1596,7 +1596,7 @@
 				     index, low_bound);
 
 	      off_tree = size_binop (PLUS_EXPR,
-				     size_binop (MULT_EXPR, convert (sizetype,
+				     size_binop (MULT_EXPR, convert2 (sizetype,
 								     index),
 						 unit_size),
 				     off_tree);
Index: gcc/tree-mudflap.c
===================================================================
--- gcc/tree-mudflap.c	(revision 111978)
+++ gcc/tree-mudflap.c	(working copy)
@@ -550,7 +550,7 @@
 
   /* Build: __mf_base = (uintptr_t) <base address expression>.  */
   t = build2 (MODIFY_EXPR, void_type_node, mf_base,
-              convert (mf_uintptr_type, unshare_expr (base)));
+              convert2 (mf_uintptr_type, unshare_expr (base)));
   SET_EXPR_LOCUS (t, locus);
   gimplify_to_stmt_list (&t);
   head = tsi_start (t);
@@ -558,7 +558,7 @@
 
   /* Build: __mf_limit = (uintptr_t) <limit address expression>.  */
   t = build2 (MODIFY_EXPR, void_type_node, mf_limit,
-              convert (mf_uintptr_type, unshare_expr (limit)));
+              convert2 (mf_uintptr_type, unshare_expr (limit)));
   SET_EXPR_LOCUS (t, locus);
   gimplify_to_stmt_list (&t);
   tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
@@ -822,7 +822,7 @@
 
         limit = fold_build2 (MINUS_EXPR, mf_uintptr_type,
                              fold_build2 (PLUS_EXPR, mf_uintptr_type,
-					  convert (mf_uintptr_type, addr),
+					  convert2 (mf_uintptr_type, addr),
 					  size),
                              integer_one_node);
       }
@@ -859,17 +859,17 @@
           return;
 
         bpu = bitsize_int (BITS_PER_UNIT);
-        ofs = convert (bitsizetype, TREE_OPERAND (t, 2));
+        ofs = convert2 (bitsizetype, TREE_OPERAND (t, 2));
         rem = size_binop (TRUNC_MOD_EXPR, ofs, bpu);
         ofs = size_binop (TRUNC_DIV_EXPR, ofs, bpu);
 
-        size = convert (bitsizetype, TREE_OPERAND (t, 1));
+        size = convert2 (bitsizetype, TREE_OPERAND (t, 1));
         size = size_binop (PLUS_EXPR, size, rem);
         size = size_binop (CEIL_DIV_EXPR, size, bpu);
-        size = convert (sizetype, size);
+        size = convert2 (sizetype, size);
 
         addr = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
-        addr = convert (ptr_type_node, addr);
+        addr = convert2 (ptr_type_node, addr);
         addr = fold_build2 (PLUS_EXPR, ptr_type_node, addr, ofs);
 
         base = addr;
@@ -990,12 +990,12 @@
           tree unregister_fncall, unregister_fncall_params;
           tree register_fncall, register_fncall_params;
 
-	  size = convert (size_type_node, TYPE_SIZE_UNIT (TREE_TYPE (decl)));
+	  size = convert2 (size_type_node, TYPE_SIZE_UNIT (TREE_TYPE (decl)));
 
           /* (& VARIABLE, sizeof (VARIABLE), __MF_TYPE_STACK) */
           unregister_fncall_params =
             tree_cons (NULL_TREE,
-                       convert (ptr_type_node,
+                       convert2 (ptr_type_node,
                                 mf_mark (build1 (ADDR_EXPR,
                                                  build_pointer_type (TREE_TYPE (decl)),
                                                  decl))),
@@ -1013,7 +1013,7 @@
           variable_name = mf_varname_tree (decl);
           register_fncall_params =
             tree_cons (NULL_TREE,
-                   convert (ptr_type_node,
+                   convert2 (ptr_type_node,
                             mf_mark (build1 (ADDR_EXPR,
                                              build_pointer_type (TREE_TYPE (decl)),
                                              decl))),
@@ -1170,11 +1170,11 @@
   arg = build_int_cst (NULL_TREE, 4); /* __MF_TYPE_STATIC */
   args = tree_cons (NULL_TREE, arg, args);
 
-  arg = convert (size_type_node, object_size);
+  arg = convert2 (size_type_node, object_size);
   args = tree_cons (NULL_TREE, arg, args);
 
   arg = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (obj)), obj);
-  arg = convert (ptr_type_node, arg);
+  arg = convert2 (ptr_type_node, arg);
   args = tree_cons (NULL_TREE, arg, args);
 
   call_stmt = build_function_call_expr (mf_register_fndecl, args);
Index: gcc/c-convert.c
===================================================================
--- gcc/c-convert.c	(revision 111978)
+++ gcc/c-convert.c	(working copy)
@@ -66,7 +66,7 @@
    not permitted by the language being compiled.  */
 
 tree
-convert (tree type, tree expr)
+c_convert_internal (tree type, tree expr)
 {
   tree e = expr;
   enum tree_code code = TREE_CODE (type);
Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c	(revision 111978)
+++ gcc/varasm.c	(working copy)
@@ -4157,8 +4157,8 @@
     return 0;
 
   /* Compute the total number of array elements.  */
-  i = size_binop (MINUS_EXPR, convert (sizetype, max_index),
-		  convert (sizetype,
+  i = size_binop (MINUS_EXPR, convert2 (sizetype, max_index),
+		  convert2 (sizetype,
 			   TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (val)))));
   i = size_binop (PLUS_EXPR, i, build_int_cst (sizetype, 1));
 
Index: gcc/tree-object-size.c
===================================================================
--- gcc/tree-object-size.c	(revision 111978)
+++ gcc/tree-object-size.c	(working copy)
@@ -134,7 +134,7 @@
 	  code = MINUS_EXPR;
 	  t = fold_build1 (NEGATE_EXPR, TREE_TYPE (t), t);
 	}
-      t = convert (sizetype, t);
+      t = convert2 (sizetype, t);
       off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t);
       break;
 
Index: gcc/c-common.c
===================================================================
--- gcc/c-common.c	(revision 111978)
+++ gcc/c-common.c	(working copy)
@@ -1046,7 +1046,7 @@
   if (TREE_CODE (c) == INTEGER_CST)
     return int_fits_type_p (c, type);
 
-  c = convert (type, c);
+  c = convert2 (type, c);
   return !TREE_OVERFLOW (c);
 }
 
@@ -1071,7 +1071,7 @@
 tree
 convert_and_check (tree type, tree expr)
 {
-  tree t = convert (type, expr);
+  tree t = convert2 (type, expr);
   if (TREE_CODE (t) == INTEGER_CST)
     {
       if (TREE_OVERFLOW (t))
@@ -1586,9 +1586,9 @@
     }
 
   if (*case_low_p != case_low)
-    *case_low_p = convert (type, case_low);
+    *case_low_p = convert2 (type, case_low);
   if (case_high_p && *case_high_p != case_high)
-    *case_high_p = convert (type, case_high);
+    *case_high_p = convert2 (type, case_high);
 
   return true;
 }
@@ -2108,8 +2108,8 @@
 	}
       if (type != *restype_ptr)
 	{
-	  minval = convert (*restype_ptr, minval);
-	  maxval = convert (*restype_ptr, maxval);
+	  minval = convert2 (*restype_ptr, minval);
+	  maxval = convert2 (*restype_ptr, maxval);
 	}
 
       if (unsignedp && unsignedp0)
@@ -2254,11 +2254,11 @@
       /* Make sure shorter operand is extended the right way
 	 to match the longer operand.  */
       primop0
-	= convert (c_common_signed_or_unsigned_type (unsignedp0,
+	= convert2 (c_common_signed_or_unsigned_type (unsignedp0,
 						     TREE_TYPE (primop0)),
 		   primop0);
       primop1
-	= convert (c_common_signed_or_unsigned_type (unsignedp1,
+	= convert2 (c_common_signed_or_unsigned_type (unsignedp1,
 						     TREE_TYPE (primop1)),
 		   primop1);
     }
@@ -2283,7 +2283,7 @@
 		 so suppress the warning.  */
 	      if (extra_warnings && !in_system_header
 		  && !(TREE_CODE (primop0) == INTEGER_CST
-		       && !TREE_OVERFLOW (convert (c_common_signed_type (type),
+		       && !TREE_OVERFLOW (convert2 (c_common_signed_type (type),
 						   primop0))))
 		warning (0, "comparison of unsigned expression >= 0 is always true");
 	      value = truthvalue_true_node;
@@ -2292,7 +2292,7 @@
 	    case LT_EXPR:
 	      if (extra_warnings && !in_system_header
 		  && !(TREE_CODE (primop0) == INTEGER_CST
-		       && !TREE_OVERFLOW (convert (c_common_signed_type (type),
+		       && !TREE_OVERFLOW (convert2 (c_common_signed_type (type),
 						   primop0))))
 		warning (0, "comparison of unsigned expression < 0 is always false");
 	      value = truthvalue_false_node;
@@ -2313,8 +2313,8 @@
 	}
     }
 
-  *op0_ptr = convert (type, primop0);
-  *op1_ptr = convert (type, primop1);
+  *op0_ptr = convert2 (type, primop0);
+  *op1_ptr = convert2 (type, primop1);
 
   *restype_ptr = truthvalue_type_node;
 
@@ -2381,8 +2381,8 @@
 	 because weird cases involving pointer arithmetic
 	 can result in a sum or difference with different type args.  */
       ptrop = build_binary_op (subcode, ptrop,
-			       convert (int_type, TREE_OPERAND (intop, 1)), 1);
-      intop = convert (int_type, TREE_OPERAND (intop, 0));
+			       convert2 (int_type, TREE_OPERAND (intop, 1)), 1);
+      intop = convert2 (int_type, TREE_OPERAND (intop, 0));
     }
 
   /* Convert the integer argument to a type the same size as sizetype
@@ -2390,16 +2390,16 @@
 
   if (TYPE_PRECISION (TREE_TYPE (intop)) != TYPE_PRECISION (sizetype)
       || TYPE_UNSIGNED (TREE_TYPE (intop)) != TYPE_UNSIGNED (sizetype))
-    intop = convert (c_common_type_for_size (TYPE_PRECISION (sizetype),
+    intop = convert2 (c_common_type_for_size (TYPE_PRECISION (sizetype),
 					     TYPE_UNSIGNED (sizetype)), intop);
 
   /* Replace the integer argument with a suitable product by the object size.
      Do this multiplication as signed, then convert to the appropriate
      pointer type (actually unsigned integral).  */
 
-  intop = convert (result_type,
+  intop = convert2 (result_type,
 		   build_binary_op (MULT_EXPR, intop,
-				    convert (TREE_TYPE (intop), size_exp), 1));
+				    convert2 (TREE_TYPE (intop), size_exp), 1));
 
   /* Create the sum or difference.  */
   return fold_build2 (resultcode, result_type, ptrop, intop);
@@ -5979,7 +5979,7 @@
 	  code = MINUS_EXPR;
 	  t = fold_build1 (NEGATE_EXPR, TREE_TYPE (t), t);
 	}
-      t = convert (sizetype, t);
+      t = convert2 (sizetype, t);
       off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t);
       break;
 
@@ -5994,7 +5994,7 @@
 fold_offsetof (tree expr)
 {
   /* Convert back from the internal sizetype to size_t.  */
-  return convert (size_type_node, fold_offsetof_1 (expr));
+  return convert2 (size_type_node, fold_offsetof_1 (expr));
 }
 
 /* Print an error message for an invalid lvalue.  USE says
@@ -6203,8 +6203,8 @@
 	 so that we get warnings for anything that doesn't match the pointer
 	 type.  This isn't portable across the C and C++ front ends atm.  */
       val = TREE_VALUE (params);
-      val = convert (ptype, val);
-      val = convert (TREE_VALUE (arg_types), val);
+      val = convert2 (ptype, val);
+      val = convert2 (TREE_VALUE (arg_types), val);
       TREE_VALUE (params) = val;
 
       arg_types = TREE_CHAIN (arg_types);
@@ -6229,7 +6229,7 @@
 {
   tree ptype = TREE_TYPE (TREE_TYPE (TREE_VALUE (params)));
   ptype = TYPE_MAIN_VARIANT (ptype);
-  return convert (ptype, result);
+  return convert2 (ptype, result);
 }
 
 /* Some builtin functions are placeholders for other expressions.  This
Index: gcc/convert.c
===================================================================
--- gcc/convert.c	(revision 111978)
+++ gcc/convert.c	(working copy)
@@ -315,7 +315,7 @@
       return build1 (FLOAT_EXPR, type, expr);
 
     case COMPLEX_TYPE:
-      return convert (type,
+      return convert2 (type,
 		      fold_build1 (REALPART_EXPR,
 				   TREE_TYPE (TREE_TYPE (expr)), expr));
 
@@ -489,7 +489,7 @@
       else if (TREE_CODE (type) == ENUMERAL_TYPE
 	       || outprec != GET_MODE_BITSIZE (TYPE_MODE (type)))
 	return build1 (NOP_EXPR, type,
-		       convert (lang_hooks.types.type_for_mode
+		       convert2 (lang_hooks.types.type_for_mode
 				(TYPE_MODE (type), TYPE_UNSIGNED (type)),
 				expr));
 
@@ -639,10 +639,10 @@
 		      typex = lang_hooks.types.unsigned_type (typex);
 		    else
 		      typex = lang_hooks.types.signed_type (typex);
-		    return convert (type,
+		    return convert2 (type,
 				    fold_build2 (ex_form, typex,
-						 convert (typex, arg0),
-						 convert (typex, arg1)));
+						 convert2 (typex, arg0),
+						 convert2 (typex, arg1)));
 		  }
 	      }
 	  }
@@ -661,9 +661,9 @@
 	      typex = lang_hooks.types.unsigned_type (type);
 	    else
 	      typex = lang_hooks.types.signed_type (type);
-	    return convert (type,
+	    return convert2 (type,
 			    fold_build1 (ex_form, typex,
-					 convert (typex,
+					 convert2 (typex,
 						  TREE_OPERAND (expr, 0))));
 	  }
 
@@ -676,14 +676,14 @@
 	    break;
 	  /* If truncating after truncating, might as well do all at once.
 	     If truncating after extending, we may get rid of wasted work.  */
-	  return convert (type, get_unwidened (TREE_OPERAND (expr, 0), type));
+	  return convert2 (type, get_unwidened (TREE_OPERAND (expr, 0), type));
 
 	case COND_EXPR:
 	  /* It is sometimes worthwhile to push the narrowing down through
 	     the conditional and never loses.  */
 	  return fold_build3 (COND_EXPR, type, TREE_OPERAND (expr, 0),
-			      convert (type, TREE_OPERAND (expr, 1)),
-			      convert (type, TREE_OPERAND (expr, 2)));
+			      convert2 (type, TREE_OPERAND (expr, 1)),
+			      convert2 (type, TREE_OPERAND (expr, 2)));
 
 	default:
 	  break;
@@ -695,7 +695,7 @@
       return build1 (FIX_TRUNC_EXPR, type, expr);
 
     case COMPLEX_TYPE:
-      return convert (type,
+      return convert2 (type,
 		      fold_build1 (REALPART_EXPR,
 				   TREE_TYPE (TREE_TYPE (expr)), expr));
 
@@ -709,7 +709,7 @@
 
     default:
       error ("aggregate value used where an integer was expected");
-      return convert (type, integer_zero_node);
+      return convert2 (type, integer_zero_node);
     }
 }
 
@@ -726,8 +726,8 @@
     case INTEGER_TYPE:
     case ENUMERAL_TYPE:
     case BOOLEAN_TYPE:
-      return build2 (COMPLEX_EXPR, type, convert (subtype, expr),
-		     convert (subtype, integer_zero_node));
+      return build2 (COMPLEX_EXPR, type, convert2 (subtype, expr),
+		     convert2 (subtype, integer_zero_node));
 
     case COMPLEX_TYPE:
       {
@@ -737,18 +737,18 @@
 	  return expr;
 	else if (TREE_CODE (expr) == COMPLEX_EXPR)
 	  return fold_build2 (COMPLEX_EXPR, type,
-			      convert (subtype, TREE_OPERAND (expr, 0)),
-			      convert (subtype, TREE_OPERAND (expr, 1)));
+			      convert2 (subtype, TREE_OPERAND (expr, 0)),
+			      convert2 (subtype, TREE_OPERAND (expr, 1)));
 	else
 	  {
 	    expr = save_expr (expr);
 	    return
 	      fold_build2 (COMPLEX_EXPR, type,
-			   convert (subtype,
+			   convert2 (subtype,
 				    fold_build1 (REALPART_EXPR,
 						 TREE_TYPE (TREE_TYPE (expr)),
 						 expr)),
-			   convert (subtype,
+			   convert2 (subtype,
 				    fold_build1 (IMAGPART_EXPR,
 						 TREE_TYPE (TREE_TYPE (expr)),
 						 expr)));







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