OSDN Git Service

2009-05-28 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / stor-layout.c
index 1a33b1c..fab5817 100644 (file)
@@ -1,6 +1,6 @@
 /* C-compiler utilities for types and variables storage layout
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1996, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -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
            {
@@ -2046,15 +2046,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 +2073,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 +2088,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))
     {