OSDN Git Service

* reorg.c (fill_slots_from_thread): Check side_effects_p when
[pf3gnuchains/gcc-fork.git] / gcc / c-typeck.c
index 3bab9ff..62a3b25 100644 (file)
@@ -1,5 +1,6 @@
 /* Build expressions with type checking for C compiler.
-   Copyright (C) 1987, 88, 91-97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+   1998, 1999, 2000 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -32,6 +33,7 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "tree.h"
 #include "c-tree.h"
+#include "tm_p.h"
 #include "flags.h"
 #include "output.h"
 #include "rtl.h"
@@ -39,41 +41,41 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "intl.h"
 #include "defaults.h"
+#include "ggc.h"
 
 /* Nonzero if we've already printed a "missing braces around initializer"
    message within this initializer.  */
 static int missing_braces_mentioned;
 
-static tree qualify_type               PROTO((tree, tree));
-static int comp_target_types           PROTO((tree, tree));
-static int function_types_compatible_p PROTO((tree, tree));
-static int type_lists_compatible_p     PROTO((tree, tree));
-static int self_promoting_type_p       PROTO((tree));
-static tree decl_constant_value                PROTO((tree));
-static tree lookup_field               PROTO((tree, tree, tree *));
-static tree convert_arguments          PROTO((tree, tree, tree, tree));
-static tree pointer_int_sum            PROTO((enum tree_code, tree, tree));
-static tree pointer_diff               PROTO((tree, tree));
-static tree unary_complex_lvalue       PROTO((enum tree_code, tree));
-static void pedantic_lvalue_warning    PROTO((enum tree_code));
-static tree internal_build_compound_expr PROTO((tree, int));
-static tree convert_for_assignment     PROTO((tree, tree, const char *, tree,
-                                              tree, int));
-static void warn_for_assignment                PROTO((const char *, const char *,
-                                              tree, int));
-static tree valid_compound_expr_initializer PROTO((tree, tree));
-static void push_string                        PROTO((const char *));
-static void push_member_name           PROTO((tree));
-static void push_array_bounds          PROTO((int));
-static int spelling_length             PROTO((void));
-static char *print_spelling            PROTO((char *));
-static void warning_init               PROTO((const char *));
-static tree digest_init                        PROTO((tree, tree, int, int));
-static void check_init_type_bitfields  PROTO((tree));
-static void output_init_element                PROTO((tree, tree, tree, int));
-static void output_pending_init_elements PROTO((int));
-static void add_pending_init           PROTO((tree, tree));
-static int pending_init_member         PROTO((tree));
+static tree qualify_type               PARAMS ((tree, tree));
+static int comp_target_types           PARAMS ((tree, tree));
+static int function_types_compatible_p PARAMS ((tree, tree));
+static int type_lists_compatible_p     PARAMS ((tree, tree));
+static tree decl_constant_value                PARAMS ((tree));
+static tree lookup_field               PARAMS ((tree, tree, tree *));
+static tree convert_arguments          PARAMS ((tree, tree, tree, tree));
+static tree pointer_int_sum            PARAMS ((enum tree_code, tree, tree));
+static tree pointer_diff               PARAMS ((tree, tree));
+static tree unary_complex_lvalue       PARAMS ((enum tree_code, tree));
+static void pedantic_lvalue_warning    PARAMS ((enum tree_code));
+static tree internal_build_compound_expr PARAMS ((tree, int));
+static tree convert_for_assignment     PARAMS ((tree, tree, const char *,
+                                                tree, tree, int));
+static void warn_for_assignment                PARAMS ((const char *, const char *,
+                                                tree, int));
+static tree valid_compound_expr_initializer PARAMS ((tree, tree));
+static void push_string                        PARAMS ((const char *));
+static void push_member_name           PARAMS ((tree));
+static void push_array_bounds          PARAMS ((int));
+static int spelling_length             PARAMS ((void));
+static char *print_spelling            PARAMS ((char *));
+static void warning_init               PARAMS ((const char *));
+static tree digest_init                        PARAMS ((tree, tree, int, int));
+static void check_init_type_bitfields  PARAMS ((tree));
+static void output_init_element                PARAMS ((tree, tree, tree, int));
+static void output_pending_init_elements PARAMS ((int));
+static void add_pending_init           PARAMS ((tree, tree));
+static int pending_init_member         PARAMS ((tree));
 \f
 /* Do `exp = require_complete_type (exp);' to make sure exp
    does not have an incomplete type.  (That includes void types.)  */
@@ -88,8 +90,7 @@ require_complete_type (value)
     return error_mark_node;
 
   /* First, detect a valid value with a complete type.  */
-  if (TYPE_SIZE (type) != 0
-      && type != void_type_node)
+  if (COMPLETE_TYPE_P (type))
     return value;
 
   incomplete_type_error (value, type);
@@ -168,7 +169,8 @@ static tree
 qualify_type (type, like)
      tree type, like;
 {
-  return c_build_qualified_type (type, TYPE_QUALS (like));
+  return c_build_qualified_type (type, 
+                                TYPE_QUALS (type) | TYPE_QUALS (like));
 }
 \f
 /* Return the common type of two types.
@@ -433,6 +435,16 @@ comptypes (type1, type2)
       || TREE_CODE (t1) == ERROR_MARK || TREE_CODE (t2) == ERROR_MARK)
     return 1;
 
+  /* If either type is the internal version of sizetype, return the
+     language version.  */
+  if (TREE_CODE (t1) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t1)
+      && TYPE_DOMAIN (t1) != 0)
+    t1 = TYPE_DOMAIN (t1);
+
+  if (TREE_CODE (t2) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t2)
+      && TYPE_DOMAIN (t2) != 0)
+    t2 = TYPE_DOMAIN (t2);
+
   /* Treat an enum type as the integer type of the same width and 
      signedness.  */
 
@@ -501,15 +513,10 @@ comptypes (type1, type2)
            || TREE_CODE (TYPE_MAX_VALUE (d2)) != INTEGER_CST)
          break;
 
-       if (! ((TREE_INT_CST_LOW (TYPE_MIN_VALUE (d1))
-                 == TREE_INT_CST_LOW (TYPE_MIN_VALUE (d2)))
-                && (TREE_INT_CST_HIGH (TYPE_MIN_VALUE (d1))
-                    == TREE_INT_CST_HIGH (TYPE_MIN_VALUE (d2)))
-                && (TREE_INT_CST_LOW (TYPE_MAX_VALUE (d1))
-                    == TREE_INT_CST_LOW (TYPE_MAX_VALUE (d2)))
-                && (TREE_INT_CST_HIGH (TYPE_MAX_VALUE (d1))
-                    == TREE_INT_CST_HIGH (TYPE_MAX_VALUE (d2)))))
-          val = 0;
+       if (! tree_int_cst_equal (TYPE_MIN_VALUE (d1), TYPE_MIN_VALUE (d2))
+           || ! tree_int_cst_equal (TYPE_MAX_VALUE (d1), TYPE_MAX_VALUE (d2)))
+         val = 0;
+
         break;
       }
 
@@ -626,12 +633,12 @@ type_lists_compatible_p (args1, args2)
         So match anything that self-promotes.  */
       if (TREE_VALUE (args1) == 0)
        {
-         if (! self_promoting_type_p (TREE_VALUE (args2)))
+         if (simple_type_promotes_to (TREE_VALUE (args2)) != NULL_TREE)
            return 0;
        }
       else if (TREE_VALUE (args2) == 0)
        {
-         if (! self_promoting_type_p (TREE_VALUE (args1)))
+         if (simple_type_promotes_to (TREE_VALUE (args1)) != NULL_TREE)
            return 0;
        }
       else if (! (newval = comptypes (TREE_VALUE (args1), TREE_VALUE (args2))))
@@ -680,48 +687,6 @@ type_lists_compatible_p (args1, args2)
       args2 = TREE_CHAIN (args2);
     }
 }
-
-/* Return 1 if PARMS specifies a fixed number of parameters
-   and none of their types is affected by default promotions.  */
-
-int
-self_promoting_args_p (parms)
-     tree parms;
-{
-  register tree t;
-  for (t = parms; t; t = TREE_CHAIN (t))
-    {
-      register tree type = TREE_VALUE (t);
-
-      if (TREE_CHAIN (t) == 0 && type != void_type_node)
-       return 0;
-
-      if (type == 0)
-       return 0;
-
-      if (TYPE_MAIN_VARIANT (type) == float_type_node)
-       return 0;
-
-      if (C_PROMOTING_INTEGER_TYPE_P (type))
-       return 0;
-    }
-  return 1;
-}
-
-/* Return 1 if TYPE is not affected by default promotions.  */
-
-static int
-self_promoting_type_p (type)
-     tree type;
-{
-  if (TYPE_MAIN_VARIANT (type) == float_type_node)
-    return 0;
-
-  if (C_PROMOTING_INTEGER_TYPE_P (type))
-    return 0;
-
-  return 1;
-}
 \f
 /* Compute the value of the `sizeof' operator.  */
 
@@ -730,36 +695,33 @@ c_sizeof (type)
      tree type;
 {
   enum tree_code code = TREE_CODE (type);
-  tree t;
 
   if (code == FUNCTION_TYPE)
     {
       if (pedantic || warn_pointer_arith)
        pedwarn ("sizeof applied to a function type");
-      return size_int (1);
+      return size_one_node;
     }
   if (code == VOID_TYPE)
     {
       if (pedantic || warn_pointer_arith)
        pedwarn ("sizeof applied to a void type");
-      return size_int (1);
+      return size_one_node;
     }
+
   if (code == ERROR_MARK)
-    return size_int (1);
-  if (TYPE_SIZE (type) == 0)
+    return size_one_node;
+
+  if (!COMPLETE_TYPE_P (type))
     {
       error ("sizeof applied to an incomplete type");
-      return size_int (0);
+      return size_zero_node;
     }
 
   /* Convert in case a char is more than one unit.  */
-  t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), 
-                 size_int (TYPE_PRECISION (char_type_node)));
-  t = convert (sizetype, t);
-  /* size_binop does not put the constant in range, so do it now.  */
-  if (TREE_CODE (t) == INTEGER_CST && force_fit_type (t, 0))
-    TREE_CONSTANT_OVERFLOW (t) = TREE_OVERFLOW (t) = 1;
-  return t;
+  return size_binop (CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type),
+                    size_int (TYPE_PRECISION (char_type_node)
+                              / BITS_PER_UNIT));
 }
 
 tree
@@ -767,21 +729,17 @@ c_sizeof_nowarn (type)
      tree type;
 {
   enum tree_code code = TREE_CODE (type);
-  tree t;
 
-  if (code == FUNCTION_TYPE
-      || code == VOID_TYPE
-      || code == ERROR_MARK)
-    return size_int (1);
-  if (TYPE_SIZE (type) == 0)
-    return size_int (0);
+  if (code == FUNCTION_TYPE || code == VOID_TYPE || code == ERROR_MARK)
+    return size_one_node;
+
+  if (!COMPLETE_TYPE_P (type))
+    return size_zero_node;
 
   /* Convert in case a char is more than one unit.  */
-  t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), 
-                 size_int (TYPE_PRECISION (char_type_node)));
-  t = convert (sizetype, t);
-  force_fit_type (t, 0);
-  return t;
+  return size_binop (CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type),
+                    size_int (TYPE_PRECISION (char_type_node)
+                              / BITS_PER_UNIT));
 }
 
 /* Compute the size to increment a pointer by.  */
@@ -791,26 +749,20 @@ c_size_in_bytes (type)
      tree type;
 {
   enum tree_code code = TREE_CODE (type);
-  tree t;
 
-  if (code == FUNCTION_TYPE)
-    return size_int (1);
-  if (code == VOID_TYPE)
-    return size_int (1);
-  if (code == ERROR_MARK)
-    return size_int (1);
-  if (TYPE_SIZE (type) == 0)
+  if (code == FUNCTION_TYPE || code == VOID_TYPE || code == ERROR_MARK)
+    return size_one_node;
+
+  if (!COMPLETE_OR_VOID_TYPE_P (type))
     {
       error ("arithmetic on pointer to an incomplete type");
-      return size_int (1);
+      return size_one_node;
     }
 
   /* Convert in case a char is more than one unit.  */
-  t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), 
-                    size_int (BITS_PER_UNIT));
-  t = convert (sizetype, t);
-  force_fit_type (t, 0);
-  return t;
+  return size_binop (CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type),
+                    size_int (TYPE_PRECISION (char_type_node)
+                              / BITS_PER_UNIT));
 }
 
 /* Implement the __alignof keyword: Return the minimum required
@@ -826,7 +778,13 @@ c_alignof (type)
     return size_int (FUNCTION_BOUNDARY / BITS_PER_UNIT);
 
   if (code == VOID_TYPE || code == ERROR_MARK)
-    return size_int (1);
+    return size_one_node;
+
+  if (!COMPLETE_TYPE_P (type))
+    {
+      error ("__alignof__ applied to an incomplete type");
+      return size_zero_node;
+    }
 
   return size_int (TYPE_ALIGN (type) / BITS_PER_UNIT);
 }
@@ -847,7 +805,7 @@ c_alignof_expr (expr)
       && DECL_C_BIT_FIELD (TREE_OPERAND (expr, 1)))
     {
       error ("`__alignof' applied to a bit-field");
-      return size_int (1);
+      return size_one_node;
     }
   else if (TREE_CODE (expr) == COMPONENT_REF
       && TREE_CODE (TREE_OPERAND (expr, 1)) == FIELD_DECL)
@@ -926,8 +884,9 @@ default_conversion (exp)
     }
 
   /* Strip NON_LVALUE_EXPRs and no-op conversions, since we aren't using as
-     an lvalue.  */
-  /* Do not use STRIP_NOPS here!  It will remove conversions from pointer
+     an lvalue. 
+
+     Do not use STRIP_NOPS here!  It will remove conversions from pointer
      to integer and cause infinite recursion.  */
   while (TREE_CODE (exp) == NON_LVALUE_EXPR
         || (TREE_CODE (exp) == NOP_EXPR
@@ -944,26 +903,19 @@ default_conversion (exp)
                              || (TYPE_PRECISION (type)
                                  >= TYPE_PRECISION (integer_type_node)))
                             && TREE_UNSIGNED (type)));
+
       return convert (type, exp);
     }
 
   if (TREE_CODE (exp) == COMPONENT_REF
-      && DECL_C_BIT_FIELD (TREE_OPERAND (exp, 1)))
-    {
-      tree width = DECL_SIZE (TREE_OPERAND (exp, 1));
-      HOST_WIDE_INT low = TREE_INT_CST_LOW (width);
-
+      && 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.  */
-
-      if (low < TYPE_PRECISION (integer_type_node))
-       {
-         if (flag_traditional && TREE_UNSIGNED (type))
-           return convert (unsigned_type_node, exp);
-         else
-           return convert (integer_type_node, exp);
-       }
-    }
+      && 0 > compare_tree_int (DECL_SIZE (TREE_OPERAND (exp, 1)),
+                              TYPE_PRECISION (integer_type_node)))
+    return convert (flag_traditional && TREE_UNSIGNED (type)
+                   ? unsigned_type_node : integer_type_node,
+                   exp);
 
   if (C_PROMOTING_INTEGER_TYPE_P (type))
     {
@@ -973,11 +925,14 @@ default_conversion (exp)
          && (flag_traditional
              || TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)))
        return convert (unsigned_type_node, exp);
+
       return convert (integer_type_node, exp);
     }
+
   if (flag_traditional && !flag_allow_single_precision
       && TYPE_MAIN_VARIANT (type) == float_type_node)
     return convert (double_type_node, exp);
+
   if (code == VOID_TYPE)
     {
       error ("void value not ignored as it ought to be");
@@ -995,8 +950,7 @@ default_conversion (exp)
       int constp = 0;
       int volatilep = 0;
 
-      if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'r'
-         || TREE_CODE_CLASS (TREE_CODE (exp)) == 'd')
+      if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'r' || DECL_P (exp))
        {
          constp = TREE_READONLY (exp);
          volatilep = TREE_THIS_VOLATILE (exp);
@@ -1188,7 +1142,7 @@ build_component_ref (datum, component)
     {
       tree indirect = 0;
 
-      if (TYPE_SIZE (type) == 0)
+      if (!COMPLETE_TYPE_P (type))
        {
          incomplete_type_error (NULL_TREE, type);
          return error_mark_node;
@@ -1198,9 +1152,8 @@ build_component_ref (datum, component)
 
       if (!field)
        {
-         error (code == RECORD_TYPE
-                ? "structure has no member named `%s'"
-                : "union has no member named `%s'",
+         error ("%s has no member named `%s'",
+                code == RECORD_TYPE ? "structure" : "union",
                 IDENTIFIER_POINTER (component));
          return error_mark_node;
        }
@@ -1261,7 +1214,7 @@ build_indirect_ref (ptr, errorstring)
          register tree ref = build1 (INDIRECT_REF,
                                      TYPE_MAIN_VARIANT (t), pointer);
 
-         if (TYPE_SIZE (t) == 0 && TREE_CODE (t) != ARRAY_TYPE)
+         if (!COMPLETE_TYPE_P (t) && TREE_CODE (t) != ARRAY_TYPE)
            {
              error ("dereferencing pointer to incomplete type");
              return error_mark_node;
@@ -1341,7 +1294,7 @@ build_array_ref (array, index)
         address arithmetic on its address.
         Likewise an array of elements of variable size.  */
       if (TREE_CODE (index) != INTEGER_CST
-         || (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array))) != 0
+         || (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (array)))
              && TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array)))) != INTEGER_CST))
        {
          if (mark_addressable (array) == 0)
@@ -1447,7 +1400,7 @@ build_function_call (function, params)
 {
   register tree fntype, fundecl = 0;
   register tree coerced_params;
-  tree name = NULL_TREE, assembler_name = NULL_TREE;
+  tree name = NULL_TREE, assembler_name = NULL_TREE, result;
 
   /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue.  */
   STRIP_TYPE_NOPS (function);
@@ -1503,28 +1456,20 @@ build_function_call (function, params)
   if (TREE_CODE (function) == ADDR_EXPR
       && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL
       && DECL_BUILT_IN (TREE_OPERAND (function, 0)))
-    switch (DECL_FUNCTION_CODE (TREE_OPERAND (function, 0)))
-      {
-      case BUILT_IN_ABS:
-      case BUILT_IN_LABS:
-      case BUILT_IN_FABS:
-       if (coerced_params == 0)
-         return integer_zero_node;
-       return build_unary_op (ABS_EXPR, TREE_VALUE (coerced_params), 0);
-      default:
-       break;
-      }
+    {
+      result = expand_tree_builtin (TREE_OPERAND (function, 0),
+                                   params, coerced_params);
+      if (result)
+       return result;
+    }
 
-  {
-    register tree result
-      = build (CALL_EXPR, TREE_TYPE (fntype),
-              function, coerced_params, NULL_TREE);
-
-    TREE_SIDE_EFFECTS (result) = 1;
-    if (TREE_TYPE (result) == void_type_node)
-      return result;
-    return require_complete_type (result);
-  }
+  result = build (CALL_EXPR, TREE_TYPE (fntype),
+                 function, coerced_params, NULL_TREE);
+
+  TREE_SIDE_EFFECTS (result) = 1;
+  if (TREE_TYPE (result) == void_type_node)
+    return result;
+  return require_complete_type (result);
 }
 \f
 /* Convert the argument expressions in the list VALUES
@@ -1590,7 +1535,7 @@ convert_arguments (typelist, values, name, fundecl)
          /* Formal parm type is specified by a function prototype.  */
          tree parmval;
 
-         if (TYPE_SIZE (type) == 0)
+         if (!COMPLETE_TYPE_P (type))
            {
              error ("type of formal parameter %d is incomplete", parmnum + 1);
              parmval = val;
@@ -1965,17 +1910,14 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
          if (!(code0 == INTEGER_TYPE && code1 == 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 = (TREE_UNSIGNED (TREE_TYPE (orig_op0))
-                        || (TREE_CODE (op1) == INTEGER_CST
-                            && (TREE_INT_CST_LOW (op1) != -1
-                                || TREE_INT_CST_HIGH (op1) != -1)));
-           }
+           /* 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 = (TREE_UNSIGNED (TREE_TYPE (orig_op0))
+                      || (TREE_CODE (op1) == INTEGER_CST
+                          && ! integer_all_onesp (op1)));
          common = 1;
        }
       break;
@@ -2021,8 +1963,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
             only if unsigned or if dividing by something we know != -1.  */
          shorten = (TREE_UNSIGNED (TREE_TYPE (orig_op0))
                     || (TREE_CODE (op1) == INTEGER_CST
-                        && (TREE_INT_CST_LOW (op1) != -1
-                            || TREE_INT_CST_HIGH (op1) != -1)));
+                        && ! integer_all_onesp (op1)));
          common = 1;
        }
       break;
@@ -2060,14 +2001,14 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
                warning ("right shift count is negative");
              else
                {
-                 if (TREE_INT_CST_LOW (op1) | TREE_INT_CST_HIGH (op1))
+                 if (! integer_zerop (op1))
                    short_shift = 1;
-                 if (TREE_INT_CST_HIGH (op1) != 0
-                     || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1)
-                         >= TYPE_PRECISION (type0)))
+
+                 if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0)
                    warning ("right shift count >= width of type");
                }
            }
+
          /* Use the type of the value to be shifted.
             This is what most traditional C compilers do.  */
          result_type = type0;
@@ -2090,11 +2031,11 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
            {
              if (tree_int_cst_sgn (op1) < 0)
                warning ("left shift count is negative");
-             else if (TREE_INT_CST_HIGH (op1) != 0
-                      || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1)
-                          >= TYPE_PRECISION (type0)))
+
+             else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0)
                warning ("left shift count >= width of type");
            }
+
          /* Use the type of the value to be shifted.
             This is what most traditional C compilers do.  */
          result_type = type0;
@@ -2118,11 +2059,10 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
            {
              if (tree_int_cst_sgn (op1) < 0)
                warning ("shift count is negative");
-             else if (TREE_INT_CST_HIGH (op1) != 0
-                      || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1)
-                          >= TYPE_PRECISION (type0)))
+             else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0)
                warning ("shift count >= width of type");
            }
+
          /* Use the type of the value to be shifted.
             This is what most traditional C compilers do.  */
          result_type = type0;
@@ -2140,6 +2080,8 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
 
     case EQ_EXPR:
     case NE_EXPR:
+      if (warn_float_equal && (code0 == REAL_TYPE || code1 == REAL_TYPE))
+       warning ("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;
@@ -2232,8 +2174,8 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
          if (comp_target_types (type0, type1))
            {
              result_type = common_type (type0, type1);
-             if ((TYPE_SIZE (TREE_TYPE (type0)) != 0)
-                 != (TYPE_SIZE (TREE_TYPE (type1)) != 0))
+             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)
@@ -2272,7 +2214,23 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
            pedwarn ("comparison between pointer and integer");
        }
       break;
-      
+
+    case UNORDERED_EXPR:
+    case ORDERED_EXPR:
+    case UNLT_EXPR:
+    case UNLE_EXPR:
+    case UNGT_EXPR:
+    case UNGE_EXPR:
+    case UNEQ_EXPR:
+      build_type = integer_type_node;
+      if (code0 != REAL_TYPE || code1 != REAL_TYPE)
+       {
+         error ("unordered comparison on non-floating point argument");
+         return error_mark_node;
+       }
+      common = 1;
+      break;
+
     default:
       break;
     }
@@ -2376,8 +2334,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
          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.  */
-             && TREE_INT_CST_HIGH (op1) == 0
-             && TYPE_PRECISION (TREE_TYPE (arg0)) > TREE_INT_CST_LOW (op1)
+             && compare_tree_int (op1, TYPE_PRECISION (TREE_TYPE (arg0))) < 0
              /* If arg is sign-extended and then unsigned-shifted,
                 we can simulate this with a signed shift in arg's type
                 only if the extended result is at least twice as wide
@@ -2387,7 +2344,8 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
                 it never happens because available widths are 2**N.  */
              && (!TREE_UNSIGNED (final_type)
                  || unsigned_arg
-                 || 2 * TYPE_PRECISION (TREE_TYPE (arg0)) <= TYPE_PRECISION (result_type)))
+                 || (2 * TYPE_PRECISION (TREE_TYPE (arg0))
+                     <= TYPE_PRECISION (result_type))))
            {
              /* Do an unsigned shift if the operand was zero-extended.  */
              result_type
@@ -2413,8 +2371,10 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
          enum tree_code xresultcode = resultcode;
          tree val 
            = shorten_compare (&xop0, &xop1, &xresult_type, &xresultcode);
+
          if (val != 0)
            return val;
+
          op0 = xop0, op1 = xop1;
          converted = 1;
          resultcode = xresultcode;
@@ -2424,50 +2384,63 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
            {
              int op0_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op0));
              int op1_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op1));
-
              int unsignedp0, unsignedp1;
              tree primop0 = get_narrower (op0, &unsignedp0);
              tree primop1 = get_narrower (op1, &unsignedp1);
 
-             /* Avoid spurious warnings for comparison with enumerators.  */
              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.  */
+                quantities that may fail. 
 
-             /* Do not warn if the comparison is being done in a signed type,
+                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 (! TREE_UNSIGNED (result_type))
                /* OK */;
-              /* Do not warn if both operands are unsigned.  */
+              /* Do not warn if both operands are the same signedness.  */
               else if (op0_signed == op1_signed)
                 /* OK */;
-             /* Do not warn if the signed quantity is an unsuffixed
-                integer literal (or some static constant expression
-                involving such literals) and it is non-negative.  */
-             else if ((op0_signed && TREE_CODE (xop0) == INTEGER_CST
-                       && tree_int_cst_sgn (xop0) >= 0)
-                      || (op1_signed && TREE_CODE (xop1) == INTEGER_CST
-                          && tree_int_cst_sgn (xop1) >= 0))
-               /* OK */;
-             /* Do not warn if the comparison is an equality operation,
-                 the unsigned quantity is an integral constant and it does
-                 not use the most significant bit of result_type.  */
-             else if ((resultcode == EQ_EXPR || resultcode == NE_EXPR)
-                      && ((op0_signed && TREE_CODE (xop1) == INTEGER_CST
-                           && int_fits_type_p (xop1, signed_type (result_type)))
-                          || (op1_signed && TREE_CODE (xop0) == INTEGER_CST
-                              && int_fits_type_p (xop0, signed_type (result_type)))))
-               /* OK */;
              else
-               warning ("comparison between signed and unsigned");
+               {
+                 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, 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)),
+                                              signed_type (result_type)))
+                   /* OK */;
+                 else
+                   warning ("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
@@ -2487,31 +2460,30 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
                    primop1 = get_narrower (TREE_OPERAND (primop1, 0),
                                            &unsignedp1);
              
-                 if (TREE_CODE (primop0) == INTEGER_CST
-                     || TREE_CODE (primop1) == INTEGER_CST)
+                 if (host_integerp (primop0, 0) || host_integerp (primop1, 0))
                    {
                      tree primop;
-                     long constant, mask;
+                     HOST_WIDE_INT constant, mask;
                      int unsignedp, bits;
 
-                     if (TREE_CODE (primop0) == INTEGER_CST)
+                     if (host_integerp (primop0, 0))
                        {
                          primop = primop1;
                          unsignedp = unsignedp1;
-                         constant = TREE_INT_CST_LOW (primop0);
+                         constant = tree_low_cst (primop0, 0);
                        }
                      else
                        {
                          primop = primop0;
                          unsignedp = unsignedp0;
-                         constant = TREE_INT_CST_LOW (primop1);
+                         constant = tree_low_cst (primop1, 0);
                        }
 
                      bits = TYPE_PRECISION (TREE_TYPE (primop));
                      if (bits < TYPE_PRECISION (result_type)
-                         && bits < HOST_BITS_PER_LONG && unsignedp)
+                         && bits < HOST_BITS_PER_WIDE_INT && unsignedp)
                        {
-                         mask = (~0L) << bits;
+                         mask = (~ (HOST_WIDE_INT) 0) << bits;
                          if ((mask & constant) != mask)
                            warning ("comparison of promoted ~unsigned with constant");
                        }
@@ -2680,7 +2652,7 @@ pointer_diff (op0, op1)
   op0 = build_binary_op (MINUS_EXPR, convert (restype, op0),
                         convert (restype, op1), 0);
   /* This generates an error if op1 is pointer to incomplete type.  */
-  if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (op1))) == 0)
+  if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (op1))))
     error ("arithmetic on pointer to an incomplete type");
 
   /* This generates an error if op0 is pointer to incomplete type.  */
@@ -2845,9 +2817,9 @@ build_unary_op (code, xarg, noconvert)
       if (typecode != POINTER_TYPE
          && typecode != INTEGER_TYPE && typecode != REAL_TYPE)
        {
-         error (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR
-                ? "wrong type argument to increment"
-                : "wrong type argument to decrement");
+         error ("wrong type argument to %s",
+                code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR
+                ? "increment" : "decrement");
          return error_mark_node;
        }
 
@@ -2864,16 +2836,16 @@ build_unary_op (code, xarg, noconvert)
          {
            /* If pointer target is an undefined struct,
               we just cannot know how to do the arithmetic.  */
-           if (TYPE_SIZE (TREE_TYPE (result_type)) == 0)
-             error (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR
-                    ? "increment of pointer to unknown structure"
-                    : "decrement of pointer to unknown structure");
+           if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (result_type)))
+             error ("%s of pointer to unknown structure",
+                    code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR
+                    ? "increment" : "decrement");
            else if ((pedantic || warn_pointer_arith)
                     && (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE
                         || TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE))
-             pedwarn (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR
-                      ? "wrong type argument to increment"
-                      : "wrong type argument to decrement");
+             pedwarn ("wrong type argument to %s",
+                      code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR
+                      ? "increment" : "decrement");
            inc = c_size_in_bytes (TREE_TYPE (result_type));
          }
        else
@@ -3011,18 +2983,16 @@ build_unary_op (code, xarg, noconvert)
 
       /* Ordinary case; arg is a COMPONENT_REF or a decl.  */
       argtype = TREE_TYPE (arg);
+
       /* If the lvalue is const or volatile, merge that into the type
          to which the address will point.  Note that you can't get a
         restricted pointer by taking the address of something, so we
         only have to deal with `const' and `volatile' here.  */
-      if (TREE_CODE_CLASS (TREE_CODE (arg)) == 'd'
-         || TREE_CODE_CLASS (TREE_CODE (arg)) == 'r')
-       {
-         if (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg))
-           argtype = c_build_type_variant (argtype,
-                                           TREE_READONLY (arg),
-                                           TREE_THIS_VOLATILE (arg));
-       }
+      if ((DECL_P (arg) || TREE_CODE_CLASS (TREE_CODE (arg)) == 'r')
+         && (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg)))
+         argtype = c_build_type_variant (argtype,
+                                         TREE_READONLY (arg),
+                                         TREE_THIS_VOLATILE (arg));
 
       argtype = build_pointer_type (argtype);
 
@@ -3045,18 +3015,9 @@ build_unary_op (code, xarg, noconvert)
                return error_mark_node;
              }
 
-           addr = convert (argtype, addr);
-
-           if (! integer_zerop (DECL_FIELD_BITPOS (field)))
-             {
-               tree offset
-                 = size_binop (EASY_DIV_EXPR, DECL_FIELD_BITPOS (field),
-                               size_int (BITS_PER_UNIT));
-               int flag = TREE_CONSTANT (addr);
-               addr = fold (build (PLUS_EXPR, argtype,
-                                   addr, convert (argtype, offset)));
-               TREE_CONSTANT (addr) = flag;
-             }
+           addr = fold (build (PLUS_EXPR, argtype,
+                               convert (argtype, addr),
+                               convert (argtype, byte_position (field))));
          }
        else
          addr = build1 (code, argtype, arg);
@@ -3155,8 +3116,10 @@ lvalue_or_else (ref, msgid)
      const char *msgid;
 {
   int win = lvalue_p (ref);
+
   if (! win)
-    error (msgid);
+    error ("%s", msgid);
+
   return win;
 }
 
@@ -3209,11 +3172,18 @@ pedantic_lvalue_warning (code)
      enum tree_code code;
 {
   if (pedantic)
-    pedwarn (code == COND_EXPR
-            ? "ANSI C forbids use of conditional expressions as lvalues"
-            : code == COMPOUND_EXPR
-            ? "ANSI C forbids use of compound expressions as lvalues"
-            : "ANSI C forbids use of cast expressions as lvalues");
+    switch (code)
+      {
+      case COND_EXPR:
+       pedwarn ("ANSI C forbids use of conditional expressions as lvalues");
+       break;
+      case COMPOUND_EXPR:
+       pedwarn ("ANSI C forbids use of compound expressions as lvalues");
+       break;
+      default:
+       pedwarn ("ANSI C forbids use of cast expressions as lvalues");
+       break;
+      }
 }
 \f
 /* Warn about storing in something that is `const'.  */
@@ -3392,6 +3362,35 @@ build_conditional_expr (ifexp, op1, op2)
            && (code2 == INTEGER_TYPE || code2 == REAL_TYPE))
     {
       result_type = common_type (type1, type2);
+
+      /* If -Wsign-compare, warn here if type1 and type2 have
+        different signedness.  We'll promote the signed to unsigned
+        and later code won't know it used to be different.
+        Do this check on the original types, so that explicit casts
+        will be considered, but default promotions won't.  */
+      if ((warn_sign_compare < 0 ? extra_warnings : warn_sign_compare)
+         && !skip_evaluation)
+       {
+         int unsigned_op1 = TREE_UNSIGNED (TREE_TYPE (orig_op1));
+         int unsigned_op2 = TREE_UNSIGNED (TREE_TYPE (orig_op2));
+
+         if (unsigned_op1 ^ unsigned_op2)
+           {
+             /* Do not warn if the result type is signed, since the
+                signed type will only be chosen if it can represent
+                all the values of the unsigned type.  */
+             if (! TREE_UNSIGNED (result_type))
+               /* OK */;
+             /* Do not warn if the signed quantity is an unsuffixed
+                integer literal (or some static constant expression
+                involving such literals) and it is non-negative.  */
+             else if ((unsigned_op2 && tree_expr_nonnegative_p (op1))
+                      || (unsigned_op1 && tree_expr_nonnegative_p (op2)))
+               /* OK */;
+             else
+               warning ("signed and unsigned type in conditional expression");
+           }
+       }
     }
   else if (code1 == VOID_TYPE || code2 == VOID_TYPE)
     {
@@ -3478,43 +3477,6 @@ build_conditional_expr (ifexp, op1, op2)
   if (result_type != TREE_TYPE (op2))
     op2 = convert_and_check (result_type, op2);
     
-#if 0
-  if (code1 == RECORD_TYPE || code1 == UNION_TYPE)
-    {
-      result_type = TREE_TYPE (op1);
-      if (TREE_CONSTANT (ifexp))
-       return pedantic_non_lvalue (integer_zerop (ifexp) ? op2 : op1);
-
-      if (TYPE_MODE (result_type) == BLKmode)
-       {
-         register tree tempvar
-           = build_decl (VAR_DECL, NULL_TREE, result_type);
-         register tree xop1 = build_modify_expr (tempvar, op1);
-         register tree xop2 = build_modify_expr (tempvar, op2);
-         register tree result = fold (build (COND_EXPR, result_type,
-                                             ifexp, xop1, xop2));
-
-         layout_decl (tempvar, TYPE_ALIGN (result_type));
-         /* No way to handle variable-sized objects here.
-            I fear that the entire handling of BLKmode conditional exprs
-            needs to be redone.  */
-         if (TREE_CODE (DECL_SIZE (tempvar)) != INTEGER_CST)
-           abort ();
-         DECL_RTL (tempvar)
-           = assign_stack_local (DECL_MODE (tempvar),
-                                 (TREE_INT_CST_LOW (DECL_SIZE (tempvar))
-                                  + BITS_PER_UNIT - 1)
-                                 / BITS_PER_UNIT,
-                                 0);
-
-         TREE_SIDE_EFFECTS (result)
-           = TREE_SIDE_EFFECTS (ifexp) | TREE_SIDE_EFFECTS (op1)
-             | TREE_SIDE_EFFECTS (op2);
-         return build (COMPOUND_EXPR, result_type, result, tempvar);
-       }
-    }
-#endif /* 0 */
-    
   if (TREE_CODE (ifexp) == INTEGER_CST)
     return pedantic_non_lvalue (integer_zerop (ifexp) ? op2 : op1);
 
@@ -3689,16 +3651,24 @@ build_c_cast (type, expr)
          && TREE_CODE (type) == POINTER_TYPE
          && TREE_CODE (otype) == POINTER_TYPE)
        {
-         /* Go to the innermost object being pointed to.  */
          tree in_type = type;
          tree in_otype = otype;
+         int warn = 0;
 
-         while (TREE_CODE (in_type) == POINTER_TYPE)
-           in_type = TREE_TYPE (in_type);
-         while (TREE_CODE (in_otype) == POINTER_TYPE)
-           in_otype = TREE_TYPE (in_otype);
-         
-         if (TYPE_QUALS (in_otype) & ~TYPE_QUALS (in_type))
+         /* Check that the qualifiers on IN_TYPE are a superset of
+            the qualifiers of IN_OTYPE.  The outermost level of
+            POINTER_TYPE nodes is uninteresting and we stop as soon
+            as we hit a non-POINTER_TYPE node on either type.  */
+         do
+           {
+             in_otype = TREE_TYPE (in_otype);
+             in_type = TREE_TYPE (in_type);
+             warn |= (TYPE_QUALS (in_otype) & ~TYPE_QUALS (in_type));
+           }
+         while (TREE_CODE (in_type) == POINTER_TYPE
+                && TREE_CODE (in_otype) == POINTER_TYPE);
+
+         if (warn)
            /* There are qualifiers present in IN_OTYPE that are not
               present in IN_TYPE.  */
            pedwarn ("cast discards qualifiers from pointer target type");
@@ -3802,8 +3772,7 @@ build_modify_expr (lhs, modifycode, rhs)
       /* Handle (a, b) used as an "lvalue".  */
     case COMPOUND_EXPR:
       pedantic_lvalue_warning (COMPOUND_EXPR);
-      newrhs = build_modify_expr (TREE_OPERAND (lhs, 1),
-                                 modifycode, rhs);
+      newrhs = build_modify_expr (TREE_OPERAND (lhs, 1), modifycode, rhs);
       if (TREE_CODE (newrhs) == ERROR_MARK)
        return error_mark_node;
       return build (COMPOUND_EXPR, lhstype,
@@ -3990,11 +3959,32 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
       error ("void value not ignored as it ought to be");
       return error_mark_node;
     }
+  /* A type converts to a reference to it.  
+     This code doesn't fully support references, it's just for the
+     special case of va_start and va_copy.  */
+  if (codel == REFERENCE_TYPE
+      && comptypes (TREE_TYPE (type), TREE_TYPE (rhs)) == 1)
+    {
+      if (mark_addressable (rhs) == 0)
+       return error_mark_node;
+      rhs = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (rhs)), rhs);
+
+      /* We already know that these two types are compatible, but they
+        may not be exactly identical.  In fact, `TREE_TYPE (type)' is
+        likely to be __builtin_va_list and `TREE_TYPE (rhs)' is
+        likely to be va_list, a typedef to __builtin_va_list, which
+        is different enough that it will cause problems later.  */
+      if (TREE_TYPE (TREE_TYPE (rhs)) != TREE_TYPE (type))
+       rhs = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (type)), rhs);
+
+      rhs = build1 (NOP_EXPR, type, rhs);
+      return rhs;
+    }
   /* Arithmetic types all interconvert, and enum is treated like int.  */
-  if ((codel == INTEGER_TYPE || codel == REAL_TYPE || codel == ENUMERAL_TYPE
-       || codel == COMPLEX_TYPE)
-      && (coder == INTEGER_TYPE || coder == REAL_TYPE || coder == ENUMERAL_TYPE
-         || coder == COMPLEX_TYPE))
+  else if ((codel == INTEGER_TYPE || codel == REAL_TYPE 
+           || codel == ENUMERAL_TYPE || codel == COMPLEX_TYPE)
+          && (coder == INTEGER_TYPE || coder == REAL_TYPE 
+              || coder == ENUMERAL_TYPE || coder == COMPLEX_TYPE))
     return convert_and_check (type, rhs);
 
   /* Conversion to a transparent union from its member types.
@@ -4092,7 +4082,8 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
     }
 
   /* Conversions among pointers */
-  else if (codel == POINTER_TYPE && coder == POINTER_TYPE)
+  else if ((codel == POINTER_TYPE || codel == REFERENCE_TYPE)
+          && (coder == POINTER_TYPE || coder == REFERENCE_TYPE))
     {
       register tree ttl = TREE_TYPE (type);
       register tree ttr = TREE_TYPE (rhstype);
@@ -4481,7 +4472,7 @@ error_init (msgid)
 {
   char *ofwhat;
 
-  error (msgid);
+  error ("%s", msgid);
   ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
   if (*ofwhat)
     error ("(near initialization for `%s')", ofwhat);
@@ -4497,7 +4488,7 @@ pedwarn_init (msgid)
 {
   char *ofwhat;
 
-  pedwarn (msgid);
+  pedwarn ("%s", msgid);
   ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
   if (*ofwhat)
     pedwarn ("(near initialization for `%s')", ofwhat);
@@ -4513,7 +4504,7 @@ warning_init (msgid)
 {
   char *ofwhat;
 
-  warning (msgid);
+  warning ("%s", msgid);
   ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
   if (*ofwhat)
     warning ("(near initialization for `%s')", ofwhat);
@@ -4534,8 +4525,8 @@ digest_init (type, init, require_constant, constructor_constant)
   enum tree_code code = TREE_CODE (type);
   tree inside_init = init;
 
-  if (init == error_mark_node)
-    return init;
+  if (type == error_mark_node || init == error_mark_node)
+    return error_mark_node;
 
   /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue.  */
   /* Do not use STRIP_NOPS here.  We do not want an enumerator
@@ -4577,19 +4568,19 @@ digest_init (type, init, require_constant, constructor_constant)
 
          TREE_TYPE (inside_init) = type;
          if (TYPE_DOMAIN (type) != 0
-             && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
-           {
-             register int size = TREE_INT_CST_LOW (TYPE_SIZE (type));
-             size = (size + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
+             && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
              /* Subtract 1 (or sizeof (wchar_t))
                 because it's ok to ignore the terminating null char
                 that is counted in the length of the constant.  */
-             if (size < TREE_STRING_LENGTH (inside_init)
-                 - (TYPE_PRECISION (typ1) != TYPE_PRECISION (char_type_node)
-                    ? TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT
-                    : 1))
-               pedwarn_init ("initializer-string for array of chars is too long");
-           }
+             && 0 > compare_tree_int (TYPE_SIZE_UNIT (type),
+                                      TREE_STRING_LENGTH (inside_init)
+                                      - ((TYPE_PRECISION (typ1)
+                                          != TYPE_PRECISION (char_type_node))
+                                         ? (TYPE_PRECISION (wchar_type_node)
+                                            / BITS_PER_UNIT)
+                                         : 1)))
+           pedwarn_init ("initializer-string for array of chars is too long");
+
          return inside_init;
        }
     }
@@ -4682,7 +4673,7 @@ digest_init (type, init, require_constant, constructor_constant)
 
   /* Come here only for records and arrays.  */
 
-  if (TYPE_SIZE (type) && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
+  if (COMPLETE_TYPE_P (type) && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
     {
       error_init ("variable-sized object may not be initialized");
       return error_mark_node;
@@ -4741,8 +4732,7 @@ static tree constructor_type;
 static tree constructor_fields;
 
 /* For an ARRAY_TYPE, this is the specified index
-   at which to store the next element we get.
-   This is a special INTEGER_CST node that we modify in place.  */
+   at which to store the next element we get.  */
 static tree constructor_index;
 
 /* For an ARRAY_TYPE, this is the end index of the range
@@ -4757,13 +4747,11 @@ static tree constructor_max_index;
 static tree constructor_unfilled_fields;
 
 /* For an ARRAY_TYPE, this is the index of the first element
-   not yet written out.
-   This is a special INTEGER_CST node that we modify in place.  */
+   not yet written out.  */
 static tree constructor_unfilled_index;
 
 /* In a RECORD_TYPE, the byte index of the next consecutive field.
-   This is so we can generate gaps between fields, when appropriate.
-   This is a special INTEGER_CST node that we modify in place.  */
+   This is so we can generate gaps between fields, when appropriate.  */
 static tree constructor_bit_index;
 
 /* If we are saving up the elements rather than allocating them,
@@ -4798,7 +4786,8 @@ struct init_node
 /* Tree of pending elements at this constructor level.
    These are elements encountered out of order
    which belong at places we haven't reached yet in actually
-   writing the output.  */
+   writing the output.
+   Will never hold tree nodes across GC runs.  */
 static struct init_node *constructor_pending_elts;
 
 /* The SPELLING_DEPTH of this constructor.  */
@@ -5045,9 +5034,9 @@ really_start_incremental_init (type)
       while (constructor_fields != 0 && DECL_C_BIT_FIELD (constructor_fields)
             && DECL_NAME (constructor_fields) == 0)
        constructor_fields = TREE_CHAIN (constructor_fields);
+
       constructor_unfilled_fields = constructor_fields;
-      constructor_bit_index = copy_node (integer_zero_node);
-      TREE_TYPE (constructor_bit_index) = sbitsizetype;
+      constructor_bit_index = bitsize_zero_node;
     }
   else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
     {
@@ -5057,11 +5046,13 @@ really_start_incremental_init (type)
          constructor_max_index
            = TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type));
          constructor_index
-           = copy_node (TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type)));
+           = convert (bitsizetype,
+                      TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type)));
        }
       else
-       constructor_index = copy_node (integer_zero_node);
-      constructor_unfilled_index = copy_node (constructor_index);
+       constructor_index = bitsize_zero_node;
+
+      constructor_unfilled_index = constructor_index;
     }
   else
     {
@@ -5072,19 +5063,10 @@ really_start_incremental_init (type)
 
   if (constructor_incremental)
     {
-      int momentary = suspend_momentary ();
-      push_obstacks_nochange ();
-      if (TREE_PERMANENT (constructor_decl))
-       end_temporary_allocation ();
       make_decl_rtl (constructor_decl, constructor_asmspec,
                     constructor_top_level);
       assemble_variable (constructor_decl, constructor_top_level, 0, 1);
-      pop_obstacks ();
-      resume_momentary (momentary);
-    }
 
-  if (constructor_incremental)
-    {
       defer_addressed_constants ();
       constructor_subconstants_deferred = 1;
     }
@@ -5125,20 +5107,16 @@ push_init_level (implicit)
     {
       /* Advance to offset of this element.  */
       if (! tree_int_cst_equal (constructor_bit_index,
-                               DECL_FIELD_BITPOS (constructor_fields)))
-       {
-         /* By using unsigned arithmetic, the result will be correct even
-            in case of overflows, if BITS_PER_UNIT is a power of two.  */
-         unsigned next = (TREE_INT_CST_LOW
-                          (DECL_FIELD_BITPOS (constructor_fields))
-                          / (unsigned)BITS_PER_UNIT);
-         unsigned here = (TREE_INT_CST_LOW (constructor_bit_index)
-                          / (unsigned)BITS_PER_UNIT);
-
-         assemble_zeros ((next - here)
-                         * (unsigned)BITS_PER_UNIT
-                         / (unsigned)BITS_PER_UNIT);
-       }
+                               bit_position (constructor_fields)))
+       assemble_zeros
+         (tree_low_cst
+          (size_binop (TRUNC_DIV_EXPR,
+                       size_binop (MINUS_EXPR,
+                                   bit_position (constructor_fields),
+                                   constructor_bit_index),
+                       bitsize_unit_node),
+           1));
+
       /* Indicate that we have now filled the structure up to the current
         field.  */
       constructor_unfilled_fields = constructor_fields;
@@ -5194,7 +5172,7 @@ push_init_level (implicit)
   else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
     {
       constructor_type = TREE_TYPE (constructor_type);
-      push_array_bounds (TREE_INT_CST_LOW (constructor_index));
+      push_array_bounds (tree_low_cst (constructor_index, 0));
       constructor_depth++;
       if (! tree_int_cst_equal (constructor_index, constructor_unfilled_index)
          || constructor_range_end != 0)
@@ -5226,9 +5204,9 @@ push_init_level (implicit)
       while (constructor_fields != 0 && DECL_C_BIT_FIELD (constructor_fields)
             && DECL_NAME (constructor_fields) == 0)
        constructor_fields = TREE_CHAIN (constructor_fields);
+
       constructor_unfilled_fields = constructor_fields;
-      constructor_bit_index = copy_node (integer_zero_node);
-      TREE_TYPE (constructor_bit_index) = sbitsizetype;
+      constructor_bit_index = bitsize_zero_node;
     }
   else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
     {
@@ -5238,11 +5216,14 @@ push_init_level (implicit)
          constructor_max_index
            = TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type));
          constructor_index
-           = copy_node (TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type)));
+           = convert (bitsizetype, 
+                                 TYPE_MIN_VALUE
+                                 (TYPE_DOMAIN (constructor_type)));
        }
       else
-       constructor_index = copy_node (integer_zero_node);
-      constructor_unfilled_index = copy_node (constructor_index);
+       constructor_index = bitsize_zero_node;
+
+      constructor_unfilled_index = constructor_index;
     }
   else
     {
@@ -5304,7 +5285,7 @@ pop_init_level (implicit)
      int implicit;
 {
   struct constructor_stack *p;
-  int size = 0;
+  HOST_WIDE_INT size = 0;
   tree constructor = 0;
 
   if (implicit == 0)
@@ -5365,29 +5346,15 @@ pop_init_level (implicit)
          if (TREE_CODE (constructor_type) == ARRAY_TYPE
              && TYPE_DOMAIN (constructor_type) == 0)
            {
-             int failure;
-             int momentary_p;
-
-             push_obstacks_nochange ();
-             if (TREE_PERMANENT (constructor_type))
-               end_temporary_allocation ();
-
-             momentary_p = suspend_momentary ();
-
              /* We shouldn't have an incomplete array type within
                 some other type.  */
              if (constructor_stack->next)
                abort ();
 
-             failure
-               = complete_array_type (constructor_type,
-                                      constructor, 0);
-             if (failure)
+             if (complete_array_type (constructor_type, constructor, 0))
                abort ();
 
              size = int_size_in_bytes (constructor_type);
-             resume_momentary (momentary_p);
-             pop_obstacks ();
            }
 
          output_constant (constructor, size);
@@ -5421,31 +5388,24 @@ pop_init_level (implicit)
        constructor = error_mark_node;
       else
        {
-         int momentary = suspend_momentary ();
-
          constructor = build (CONSTRUCTOR, constructor_type, NULL_TREE,
                               nreverse (constructor_elements));
          if (constructor_constant)
            TREE_CONSTANT (constructor) = 1;
          if (constructor_constant && constructor_simple)
            TREE_STATIC (constructor) = 1;
-
-         resume_momentary (momentary);
        }
     }
   else
     {
       tree filled;
-      int momentary = suspend_momentary ();
 
       if (TREE_CODE (constructor_type) == RECORD_TYPE
          || TREE_CODE (constructor_type) == UNION_TYPE)
-       {
-         /* Find the offset of the end of that field.  */
-         filled = size_binop (CEIL_DIV_EXPR,
-                              constructor_bit_index,
-                              size_int (BITS_PER_UNIT));
-       }
+       /* Find the offset of the end of that field.  */
+       filled = size_binop (CEIL_DIV_EXPR, constructor_bit_index,
+                            bitsize_unit_node);
+
       else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
        {
          /* If initializing an array of unknown size,
@@ -5454,14 +5414,9 @@ pop_init_level (implicit)
              && TYPE_DOMAIN (constructor_type) == 0)
            {
              tree maxindex
-               = size_binop (MINUS_EXPR,
-                             constructor_unfilled_index,
-                             integer_one_node);
-
-             push_obstacks_nochange ();
-             if (TREE_PERMANENT (constructor_type))
-               end_temporary_allocation ();
-             maxindex = copy_node (maxindex);
+               = copy_node (size_diffop (constructor_unfilled_index,
+                                         bitsize_one_node));
+
              TYPE_DOMAIN (constructor_type) = build_index_type (maxindex);
              TREE_TYPE (maxindex) = TYPE_DOMAIN (constructor_type);
 
@@ -5469,25 +5424,27 @@ pop_init_level (implicit)
                 in the array, because we start counting at zero.  Therefore,
                 warn only if the value is less than zero.  */
              if (pedantic
-                 && (tree_int_cst_sgn (TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type)))
+                 && (tree_int_cst_sgn
+                     (TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type)))
                      < 0))
                error_with_decl (constructor_decl,
                                 "zero or negative array size `%s'");
+
              layout_type (constructor_type);
              size = int_size_in_bytes (constructor_type);
-             pop_obstacks ();
            }
 
-         filled = size_binop (MULT_EXPR, constructor_unfilled_index,
-                              size_in_bytes (TREE_TYPE (constructor_type)));
+         filled
+           = size_binop (MULT_EXPR, constructor_unfilled_index,
+                         convert (bitsizetype,
+                                  TYPE_SIZE_UNIT
+                                  (TREE_TYPE (constructor_type))));
        }
       else
        filled = 0;
 
       if (filled != 0)
-       assemble_zeros (size - TREE_INT_CST_LOW (filled));
-
-      resume_momentary (momentary);
+       assemble_zeros (size - tree_low_cst (filled, 1));
     }
 
          
@@ -5533,14 +5490,15 @@ set_init_index (first, last)
          || TREE_CODE (first) == NON_LVALUE_EXPR)
         && (TYPE_MODE (TREE_TYPE (first))
             == TYPE_MODE (TREE_TYPE (TREE_OPERAND (first, 0)))))
-    (first) = TREE_OPERAND (first, 0);
+    first = TREE_OPERAND (first, 0);
+
   if (last)
     while ((TREE_CODE (last) == NOP_EXPR
            || TREE_CODE (last) == CONVERT_EXPR
            || TREE_CODE (last) == NON_LVALUE_EXPR)
           && (TYPE_MODE (TREE_TYPE (last))
               == TYPE_MODE (TREE_TYPE (TREE_OPERAND (last, 0)))))
-      (last) = TREE_OPERAND (last, 0);
+      last = TREE_OPERAND (last, 0);
 
   if (TREE_CODE (first) != INTEGER_CST)
     error_init ("nonconstant array index in initializer");
@@ -5552,8 +5510,7 @@ set_init_index (first, last)
     error_init ("duplicate array index in initializer");
   else
     {
-      TREE_INT_CST_LOW (constructor_index) = TREE_INT_CST_LOW (first);
-      TREE_INT_CST_HIGH (constructor_index) = TREE_INT_CST_HIGH (first);
+      constructor_index = convert (bitsizetype, first);
 
       if (last != 0 && tree_int_cst_lt (last, first))
        error_init ("empty index range in initializer");
@@ -5561,7 +5518,8 @@ set_init_index (first, last)
        {
          if (pedantic)
            pedwarn ("ANSI C forbids specifying element to initialize");
-         constructor_range_end = last;
+
+         constructor_range_end = last ? convert (bitsizetype, last) : 0;
        }
     }
 }
@@ -5623,7 +5581,7 @@ add_pending_init (purpose, value)
          p = *q;
          if (tree_int_cst_lt (purpose, p->purpose))
            q = &p->left;
-         else if (tree_int_cst_lt (p->purpose, purpose))
+         else if (p->purpose != purpose)
            q = &p->right;
          else
            abort ();
@@ -5634,18 +5592,17 @@ add_pending_init (purpose, value)
       while (*q != NULL)
        {
          p = *q;
-         if (tree_int_cst_lt (DECL_FIELD_BITPOS (purpose),
-                              DECL_FIELD_BITPOS (p->purpose)))
+         if (tree_int_cst_lt (bit_position (purpose),
+                              bit_position (p->purpose)))
            q = &p->left;
-         else if (tree_int_cst_lt (DECL_FIELD_BITPOS (p->purpose),
-                                   DECL_FIELD_BITPOS (purpose)))
+         else if (p->purpose != purpose)
            q = &p->right;
          else
            abort ();
        }
     }
 
-  r = (struct init_node *) oballoc (sizeof (struct init_node));
+  r = (struct init_node *) ggc_alloc_obj (sizeof (struct init_node), 0);
   r->purpose = purpose;
   r->value = value;
 
@@ -5823,7 +5780,7 @@ pending_init_member (field)
     {
       while (p)
        {
-         if (tree_int_cst_equal (field, p->purpose))
+         if (field == p->purpose)
            return 1;
          else if (tree_int_cst_lt (field, p->purpose))
            p = p->left;
@@ -5837,8 +5794,8 @@ pending_init_member (field)
        {
          if (field == p->purpose)
            return 1;
-         else if (tree_int_cst_lt (DECL_FIELD_BITPOS (field),
-                                   DECL_FIELD_BITPOS (p->purpose)))
+         else if (tree_int_cst_lt (bit_position (field),
+                                   bit_position (p->purpose)))
            p = p->left;
          else
            p = p->right;
@@ -5918,12 +5875,10 @@ output_init_element (value, type, field, pending)
   /* If this element doesn't come next in sequence,
      put it on constructor_pending_elts.  */
   if (TREE_CODE (constructor_type) == ARRAY_TYPE
-      && !tree_int_cst_equal (field, constructor_unfilled_index))
+      && ! tree_int_cst_equal (field, constructor_unfilled_index))
     {
       if (! duplicate)
-       /* The copy_node is needed in case field is actually
-          constructor_index, which is modified in place.  */
-       add_pending_init (copy_node (field),
+       add_pending_init (field,
                          digest_init (type, value, require_constant_value, 
                                       require_constant_elements));
     }
@@ -5959,27 +5914,18 @@ output_init_element (value, type, field, pending)
            {
              /* Structure elements may require alignment.
                 Do this, if necessary.  */
-             if (TREE_CODE (constructor_type) == RECORD_TYPE)
-               {
-                 /* Advance to offset of this element.  */
-                 if (! tree_int_cst_equal (constructor_bit_index,
-                                           DECL_FIELD_BITPOS (field)))
-                   {
-                     /* By using unsigned arithmetic, the result will be
-                        correct even in case of overflows, if BITS_PER_UNIT
-                        is a power of two.  */
-                     unsigned next = (TREE_INT_CST_LOW
-                                      (DECL_FIELD_BITPOS (field))
-                                      / (unsigned)BITS_PER_UNIT);
-                     unsigned here = (TREE_INT_CST_LOW
-                                      (constructor_bit_index)
-                                      / (unsigned)BITS_PER_UNIT);
-
-                     assemble_zeros ((next - here)
-                                     * (unsigned)BITS_PER_UNIT
-                                     / (unsigned)BITS_PER_UNIT);
-                   }
-               }
+             if (TREE_CODE (constructor_type) == RECORD_TYPE
+                 && ! tree_int_cst_equal (constructor_bit_index,
+                                          bit_position (field)))
+               /* Advance to offset of this element.  */
+               assemble_zeros
+                 (tree_low_cst
+                  (size_binop (TRUNC_DIV_EXPR,
+                               size_binop (MINUS_EXPR, bit_position (field),
+                                           constructor_bit_index),
+                               bitsize_unit_node),
+                   0));
+
              output_constant (digest_init (type, value,
                                            require_constant_value,
                                            require_constant_elements),
@@ -5989,31 +5935,22 @@ output_init_element (value, type, field, pending)
                 keep track of end position of last field.  */
              if (TREE_CODE (constructor_type) == RECORD_TYPE
                  || TREE_CODE (constructor_type) == UNION_TYPE)
-               {
-                 tree temp = size_binop (PLUS_EXPR, DECL_FIELD_BITPOS (field),
-                                         DECL_SIZE (field));
-                 TREE_INT_CST_LOW (constructor_bit_index)
-                   = TREE_INT_CST_LOW (temp);
-                 TREE_INT_CST_HIGH (constructor_bit_index)
-                   = TREE_INT_CST_HIGH (temp);
-               }
+               constructor_bit_index
+                 = size_binop (PLUS_EXPR, bit_position (field),
+                               DECL_SIZE (field));
            }
        }
 
       /* Advance the variable that indicates sequential elements output.  */
       if (TREE_CODE (constructor_type) == ARRAY_TYPE)
-       {
-         tree tem = size_binop (PLUS_EXPR, constructor_unfilled_index,
-                                integer_one_node);
-         TREE_INT_CST_LOW (constructor_unfilled_index)
-           = TREE_INT_CST_LOW (tem);
-         TREE_INT_CST_HIGH (constructor_unfilled_index)
-           = TREE_INT_CST_HIGH (tem);
-       }
+       constructor_unfilled_index
+         = size_binop (PLUS_EXPR, constructor_unfilled_index,
+                       bitsize_one_node);
       else if (TREE_CODE (constructor_type) == RECORD_TYPE)
        {
-         constructor_unfilled_fields =
-           TREE_CHAIN (constructor_unfilled_fields);
+         constructor_unfilled_fields
+           = TREE_CHAIN (constructor_unfilled_fields);
+
          /* Skip any nameless bit fields.  */
          while (constructor_unfilled_fields != 0
                 && DECL_C_BIT_FIELD (constructor_unfilled_fields)
@@ -6113,8 +6050,8 @@ output_pending_init_elements (all)
                                   constructor_unfilled_fields,
                                   0);
            }
-         else if (tree_int_cst_lt (DECL_FIELD_BITPOS (constructor_unfilled_fields),
-                                   DECL_FIELD_BITPOS (elt->purpose)))
+         else if (tree_int_cst_lt (bit_position (constructor_unfilled_fields),
+                                   bit_position (elt->purpose)))
            {
              /* Advance to the next smaller node.  */
              if (elt->left)
@@ -6140,8 +6077,9 @@ output_pending_init_elements (all)
                    elt = elt->parent;
                  elt = elt->parent;
                  if (elt
-                     && tree_int_cst_lt (DECL_FIELD_BITPOS (constructor_unfilled_fields),
-                                         DECL_FIELD_BITPOS (elt->purpose)))
+                     && (tree_int_cst_lt
+                         (bit_position (constructor_unfilled_fields),
+                          bit_position (elt->purpose))))
                    {
                      next = elt->purpose;
                      break;
@@ -6160,12 +6098,13 @@ output_pending_init_elements (all)
   if (constructor_incremental)
     {
       tree filled;
-      tree nextpos_tree = size_int (0);
+      tree nextpos_tree = bitsize_zero_node;
 
       if (TREE_CODE (constructor_type) == RECORD_TYPE
          || TREE_CODE (constructor_type) == UNION_TYPE)
        {
          tree tail;
+
          /* Find the last field written out, if any.  */
          for (tail = TYPE_FIELDS (constructor_type); tail;
               tail = TREE_CHAIN (tail))
@@ -6175,44 +6114,34 @@ output_pending_init_elements (all)
          if (tail)
            /* Find the offset of the end of that field.  */
            filled = size_binop (CEIL_DIV_EXPR,
-                                size_binop (PLUS_EXPR,
-                                            DECL_FIELD_BITPOS (tail),
+                                size_binop (PLUS_EXPR, bit_position (tail),
                                             DECL_SIZE (tail)),
-                                size_int (BITS_PER_UNIT));
+                                bitsize_unit_node);
          else
-           filled = size_int (0);
-
-         nextpos_tree = size_binop (CEIL_DIV_EXPR,
-                                    DECL_FIELD_BITPOS (next),
-                                    size_int (BITS_PER_UNIT));
+           filled = bitsize_zero_node;
 
-         TREE_INT_CST_HIGH (constructor_bit_index)
-           = TREE_INT_CST_HIGH (DECL_FIELD_BITPOS (next));
-         TREE_INT_CST_LOW (constructor_bit_index)
-           = TREE_INT_CST_LOW (DECL_FIELD_BITPOS (next));
+         nextpos_tree = convert (bitsizetype, byte_position (next));
+         constructor_bit_index = bit_position (next);
          constructor_unfilled_fields = next;
        }
       else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
        {
-         filled = size_binop (MULT_EXPR, constructor_unfilled_index,
-                              size_in_bytes (TREE_TYPE (constructor_type)));
+         filled
+           = size_binop (MULT_EXPR, constructor_unfilled_index,
+                         convert (bitsizetype,
+                                  TYPE_SIZE_UNIT
+                                  (TREE_TYPE (constructor_type))));
          nextpos_tree
            = size_binop (MULT_EXPR, next,
-                         size_in_bytes (TREE_TYPE (constructor_type)));
-         TREE_INT_CST_LOW (constructor_unfilled_index)
-           = TREE_INT_CST_LOW (next);
-         TREE_INT_CST_HIGH (constructor_unfilled_index)
-           = TREE_INT_CST_HIGH (next);
+                         convert (bitsizetype, TYPE_SIZE_UNIT
+                                  (TREE_TYPE (constructor_type))));
+         constructor_unfilled_index = next;
        }
       else
        filled = 0;
 
       if (filled)
-       {
-         int nextpos = TREE_INT_CST_LOW (nextpos_tree);
-
-         assemble_zeros (nextpos - TREE_INT_CST_LOW (filled));
-       }
+       assemble_zeros (tree_low_cst (size_diffop (nextpos_tree, filled), 1));
     }
   else
     {
@@ -6223,12 +6152,7 @@ output_pending_init_elements (all)
          || TREE_CODE (constructor_type) == UNION_TYPE)
        constructor_unfilled_fields = next;
       else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
-       {
-         TREE_INT_CST_LOW (constructor_unfilled_index)
-           = TREE_INT_CST_LOW (next);
-         TREE_INT_CST_HIGH (constructor_unfilled_index)
-           = TREE_INT_CST_HIGH (next);
-       }
+       constructor_unfilled_index = next;
     }
 
   /* ELT now points to the node in the pending tree with the next
@@ -6346,13 +6270,10 @@ process_init_element (value)
               directly output as a constructor.  */
            {
              /* For a record, keep track of end position of last field.  */
-             tree temp = size_binop (PLUS_EXPR,
-                                     DECL_FIELD_BITPOS (constructor_fields),
-                                     DECL_SIZE (constructor_fields));
-             TREE_INT_CST_LOW (constructor_bit_index)
-               = TREE_INT_CST_LOW (temp);
-             TREE_INT_CST_HIGH (constructor_bit_index)
-               = TREE_INT_CST_HIGH (temp);
+             constructor_bit_index
+               = size_binop (PLUS_EXPR,
+                             bit_position (constructor_fields),
+                             DECL_SIZE (constructor_fields));
 
              constructor_unfilled_fields = TREE_CHAIN (constructor_fields);
              /* Skip any nameless bit fields.  */
@@ -6415,11 +6336,7 @@ process_init_element (value)
            /* Do the bookkeeping for an element that was
               directly output as a constructor.  */
            {
-             TREE_INT_CST_LOW (constructor_bit_index)
-               = TREE_INT_CST_LOW (DECL_SIZE (constructor_fields));
-             TREE_INT_CST_HIGH (constructor_bit_index)
-               = TREE_INT_CST_HIGH (DECL_SIZE (constructor_fields));
-
+             constructor_bit_index = DECL_SIZE (constructor_fields);
              constructor_unfilled_fields = TREE_CHAIN (constructor_fields);
            }
 
@@ -6464,10 +6381,7 @@ process_init_element (value)
                                      constructor_range_end))
                {
                  pedwarn_init ("excess elements in array initializer");
-                 TREE_INT_CST_HIGH (constructor_range_end)
-                   = TREE_INT_CST_HIGH (constructor_max_index);
-                 TREE_INT_CST_LOW (constructor_range_end)
-                   = TREE_INT_CST_LOW (constructor_max_index);
+                 constructor_range_end = constructor_max_index;
                }
 
              value = save_expr (value);
@@ -6478,30 +6392,21 @@ process_init_element (value)
             If there is a range, repeat it till we advance past the range.  */
          do
            {
-             tree tem;
-
              if (value)
                {
-                 push_array_bounds (TREE_INT_CST_LOW (constructor_index));
+                 push_array_bounds (tree_low_cst (constructor_index, 0));
                  output_init_element (value, elttype, constructor_index, 1);
                  RESTORE_SPELLING_DEPTH (constructor_depth);
                }
 
-             tem = size_binop (PLUS_EXPR, constructor_index,
-                               integer_one_node);
-             TREE_INT_CST_LOW (constructor_index) = TREE_INT_CST_LOW (tem);
-             TREE_INT_CST_HIGH (constructor_index) = TREE_INT_CST_HIGH (tem);
+             constructor_index
+               = size_binop (PLUS_EXPR, constructor_index, bitsize_one_node);
 
-             if (!value)
+             if (! value)
                /* If we are doing the bookkeeping for an element that was
-                  directly output as a constructor,
-                  we must update constructor_unfilled_index.  */
-               {
-                 TREE_INT_CST_LOW (constructor_unfilled_index)
-                   = TREE_INT_CST_LOW (constructor_index);
-                 TREE_INT_CST_HIGH (constructor_unfilled_index)
-                   = TREE_INT_CST_HIGH (constructor_index);
-               }
+                  directly output as a constructor, we must update
+                  constructor_unfilled_index.  */
+               constructor_unfilled_index = constructor_index;
            }
          while (! (constructor_range_end == 0
                    || tree_int_cst_lt (constructor_range_end,
@@ -6523,12 +6428,6 @@ process_init_element (value)
       constructor_fields = 0;
       break;
     }
-
-  /* If the (lexically) previous elments are not now saved,
-     we can discard the storage for them.  */
-  if (constructor_incremental && constructor_pending_elts == 0 && value != 0
-      && constructor_stack == 0)
-    clear_momentary ();
 }
 \f
 /* Expand an ASM statement with operands, handling output operands
@@ -6560,7 +6459,26 @@ c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
 
   /* Record the contents of OUTPUTS before it is modified.  */
   for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++)
-    o[i] = TREE_VALUE (tail);
+    {
+      tree output = TREE_VALUE (tail);
+
+      /* We can remove conversions that just change the type, not the mode.  */
+      STRIP_NOPS (output);
+      o[i] = output;
+
+      /* Allow conversions as LHS here.  build_modify_expr as called below
+        will do the right thing with them.  */
+      while (TREE_CODE (output) == NOP_EXPR
+            || TREE_CODE (output) == CONVERT_EXPR
+            || TREE_CODE (output) == FLOAT_EXPR
+            || TREE_CODE (output) == FIX_TRUNC_EXPR
+            || TREE_CODE (output) == FIX_FLOOR_EXPR
+            || TREE_CODE (output) == FIX_ROUND_EXPR
+            || TREE_CODE (output) == FIX_CEIL_EXPR)
+       output = TREE_OPERAND (output, 0);
+
+      lvalue_or_else (o[i], "invalid lvalue in asm statement");
+    }
 
   /* Perform default conversions on array and function inputs.  */
   /* Don't do this for other types--
@@ -6726,6 +6644,7 @@ c_expand_start_case (exp)
       type = TYPE_MAIN_VARIANT (TREE_TYPE (exp));
 
       if (warn_traditional
+         && ! in_system_header
          && (type == long_integer_type_node
              || type == long_unsigned_type_node))
        pedwarn ("`long' switch expression not converted to `int' in ANSI C");