OSDN Git Service

* doc/invoke.texi (-mfix-and-continue): Add support for
[pf3gnuchains/gcc-fork.git] / gcc / convert.c
index c7d12b5..9517c50 100644 (file)
@@ -43,8 +43,7 @@ convert_to_pointer (tree type, tree expr)
 {
   if (integer_zerop (expr))
     {
-      expr = build_int_2 (0, 0);
-      TREE_TYPE (expr) = type;
+      expr = build_int_cst (type, 0, 0);
       return expr;
     }
 
@@ -99,7 +98,8 @@ strip_float_extensions (tree exp)
        return build_real (type, real_value_truncate (TYPE_MODE (type), orig));
     }
 
-  if (TREE_CODE (exp) != NOP_EXPR)
+  if (TREE_CODE (exp) != NOP_EXPR
+      && TREE_CODE (exp) != CONVERT_EXPR)
     return exp;
 
   sub = TREE_OPERAND (exp, 0);
@@ -267,9 +267,9 @@ convert_to_real (tree type, tree expr)
                    newtype = TREE_TYPE (arg1);
                  if (TYPE_PRECISION (newtype) < TYPE_PRECISION (itype))
                    {
-                     expr = build (TREE_CODE (expr), newtype,
-                                   fold (convert_to_real (newtype, arg0)),
-                                   fold (convert_to_real (newtype, arg1)));
+                     expr = build2 (TREE_CODE (expr), newtype,
+                                    fold (convert_to_real (newtype, arg0)),
+                                    fold (convert_to_real (newtype, arg1)));
                      if (newtype == type)
                        return expr;
                    }
@@ -339,7 +339,8 @@ convert_to_integer (tree type, tree expr)
      so only proceed in "unsafe" math mode.  */
   if (optimize
       && (flag_unsafe_math_optimizations
-         || outprec >= TYPE_PRECISION (long_integer_type_node)))
+         || (long_integer_type_node
+             && outprec >= TYPE_PRECISION (long_integer_type_node))))
     {
       tree s_expr = strip_float_extensions (expr);
       tree s_intype = TREE_TYPE (s_expr);
@@ -523,7 +524,7 @@ convert_to_integer (tree type, tree expr)
                  /* If the original expression had side-effects, we must
                     preserve it.  */
                  if (TREE_SIDE_EFFECTS (expr))
-                   return build (COMPOUND_EXPR, type, expr, t);
+                   return build2 (COMPOUND_EXPR, type, expr, t);
                  else
                    return t;
                }
@@ -603,9 +604,9 @@ convert_to_integer (tree type, tree expr)
                    else
                      typex = lang_hooks.types.signed_type (typex);
                    return convert (type,
-                                   fold (build (ex_form, typex,
-                                                convert (typex, arg0),
-                                                convert (typex, arg1))));
+                                   fold (build2 (ex_form, typex,
+                                                 convert (typex, arg0),
+                                                 convert (typex, arg1))));
                  }
              }
          }
@@ -656,15 +657,15 @@ convert_to_integer (tree type, tree expr)
        case COND_EXPR:
          /* It is sometimes worthwhile to push the narrowing down through
             the conditional and never loses.  */
-         return fold (build (COND_EXPR, type, TREE_OPERAND (expr, 0),
-                             convert (type, TREE_OPERAND (expr, 1)),
-                             convert (type, TREE_OPERAND (expr, 2))));
+         return fold (build3 (COND_EXPR, type, TREE_OPERAND (expr, 0),
+                              convert (type, TREE_OPERAND (expr, 1)),
+                              convert (type, TREE_OPERAND (expr, 2))));
 
        default:
          break;
        }
 
-      return build1 (NOP_EXPR, type, expr);
+      return build1 (CONVERT_EXPR, type, expr);
 
     case REAL_TYPE:
       return build1 (FIX_TRUNC_EXPR, type, expr);
@@ -675,8 +676,7 @@ convert_to_integer (tree type, tree expr)
                                    TREE_TYPE (TREE_TYPE (expr)), expr)));
 
     case VECTOR_TYPE:
-      if (GET_MODE_SIZE (TYPE_MODE (type))
-         != GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (expr))))
+      if (!tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (TREE_TYPE (expr))))
        {
          error ("can't convert between vector values of different size");
          return error_mark_node;
@@ -703,8 +703,8 @@ convert_to_complex (tree type, tree expr)
     case ENUMERAL_TYPE:
     case BOOLEAN_TYPE:
     case CHAR_TYPE:
-      return build (COMPLEX_EXPR, type, convert (subtype, expr),
-                   convert (subtype, integer_zero_node));
+      return build2 (COMPLEX_EXPR, type, convert (subtype, expr),
+                    convert (subtype, integer_zero_node));
 
     case COMPLEX_TYPE:
       {
@@ -713,23 +713,22 @@ convert_to_complex (tree type, tree expr)
        if (TYPE_MAIN_VARIANT (elt_type) == TYPE_MAIN_VARIANT (subtype))
          return expr;
        else if (TREE_CODE (expr) == COMPLEX_EXPR)
-         return fold (build (COMPLEX_EXPR,
-                             type,
-                             convert (subtype, TREE_OPERAND (expr, 0)),
-                             convert (subtype, TREE_OPERAND (expr, 1))));
+         return fold (build2 (COMPLEX_EXPR, type,
+                              convert (subtype, TREE_OPERAND (expr, 0)),
+                              convert (subtype, TREE_OPERAND (expr, 1))));
        else
          {
            expr = save_expr (expr);
            return
-             fold (build (COMPLEX_EXPR,
-                          type, convert (subtype,
-                                         fold (build1 (REALPART_EXPR,
-                                                       TREE_TYPE (TREE_TYPE (expr)),
-                                                       expr))),
-                          convert (subtype,
-                                   fold (build1 (IMAGPART_EXPR,
-                                                 TREE_TYPE (TREE_TYPE (expr)),
-                                                 expr)))));
+             fold (build2 (COMPLEX_EXPR, type,
+                           convert (subtype,
+                                    fold (build1 (REALPART_EXPR,
+                                                  TREE_TYPE (TREE_TYPE (expr)),
+                                                  expr))),
+                           convert (subtype,
+                                    fold (build1 (IMAGPART_EXPR,
+                                                  TREE_TYPE (TREE_TYPE (expr)),
+                                                  expr)))));
          }
       }
 
@@ -753,8 +752,7 @@ convert_to_vector (tree type, tree expr)
     {
     case INTEGER_TYPE:
     case VECTOR_TYPE:
-      if (GET_MODE_SIZE (TYPE_MODE (type))
-         != GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (expr))))
+      if (!tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (TREE_TYPE (expr))))
        {
          error ("can't convert between vector values of different size");
          return error_mark_node;