OSDN Git Service

2009-06-17 H.J. Lu <hongjiu.lu@intel.com>
[pf3gnuchains/gcc-fork.git] / gcc / stor-layout.c
index 581cb89..d65452b 100644 (file)
@@ -1292,19 +1292,19 @@ finalize_record_size (record_layout_info rli)
 
          if (TYPE_NAME (rli->t))
            {
-             const char *name;
+             tree name;
 
              if (TREE_CODE (TYPE_NAME (rli->t)) == IDENTIFIER_NODE)
-               name = IDENTIFIER_POINTER (TYPE_NAME (rli->t));
+               name = TYPE_NAME (rli->t);
              else
-               name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (rli->t)));
+               name = DECL_NAME (TYPE_NAME (rli->t));
 
              if (STRICT_ALIGNMENT)
                warning (OPT_Wpacked, "packed attribute causes inefficient "
-                        "alignment for %qs", name);
+                        "alignment for %qE", name);
              else
                warning (OPT_Wpacked,
-                        "packed attribute is unnecessary for %qs", name);
+                        "packed attribute is unnecessary for %qE", name);
            }
          else
            {
@@ -1547,7 +1547,8 @@ finish_builtin_struct (tree type, const char *name, tree fields,
 #if 0 /* not yet, should get fixed properly later */
   TYPE_NAME (type) = make_type_decl (get_identifier (name), type);
 #else
-  TYPE_NAME (type) = build_decl (TYPE_DECL, get_identifier (name), type);
+  TYPE_NAME (type) = build_decl (BUILTINS_LOCATION,
+                                TYPE_DECL, get_identifier (name), type);
 #endif
   TYPE_STUB_DECL (type) = TYPE_NAME (type);
   layout_decl (TYPE_NAME (type), 0);
@@ -2046,15 +2047,18 @@ initialize_sizetypes (bool signed_p)
 void
 set_sizetype (tree type)
 {
+  tree t;
   int oprecision = TYPE_PRECISION (type);
   /* The *bitsizetype types use a precision that avoids overflows when
      calculating signed sizes / offsets in bits.  However, when
      cross-compiling from a 32 bit to a 64 bit host, we are limited to 64 bit
      precision.  */
-  int precision = MIN (MIN (oprecision + BITS_PER_UNIT_LOG + 1,
-                           MAX_FIXED_MODE_SIZE),
-                      2 * HOST_BITS_PER_WIDE_INT);
-  tree t;
+  int precision
+    = MIN (oprecision + BITS_PER_UNIT_LOG + 1, MAX_FIXED_MODE_SIZE);
+  precision
+    = GET_MODE_PRECISION (smallest_mode_for_size (precision, MODE_INT));
+  if (precision > HOST_BITS_PER_WIDE_INT * 2)
+    precision = HOST_BITS_PER_WIDE_INT * 2;
 
   gcc_assert (TYPE_UNSIGNED (type) == TYPE_UNSIGNED (sizetype));
 
@@ -2070,6 +2074,7 @@ set_sizetype (tree type)
   /* Replace our original stub sizetype.  */
   memcpy (sizetype, t, tree_size (sizetype));
   TYPE_MAIN_VARIANT (sizetype) = sizetype;
+  TYPE_CANONICAL (sizetype) = sizetype;
 
   t = make_node (INTEGER_TYPE);
   TYPE_NAME (t) = get_identifier ("bit_size_type");
@@ -2084,6 +2089,7 @@ set_sizetype (tree type)
   /* Replace our original stub bitsizetype.  */
   memcpy (bitsizetype, t, tree_size (bitsizetype));
   TYPE_MAIN_VARIANT (bitsizetype) = bitsizetype;
+  TYPE_CANONICAL (bitsizetype) = bitsizetype;
 
   if (TYPE_UNSIGNED (type))
     {