Blame SOURCES/gdb-rhbz1320945-float128-4of9.patch

2c2fa1
commit 19f392bc2a93d9e64d063b884cd6eca547c8dad0
2c2fa1
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2c2fa1
Date:   Tue Sep 6 17:27:55 2016 +0200
2c2fa1
2c2fa1
    Unify init_type and arch_type interface and helpers
2c2fa1
    
2c2fa1
    This adds a number of helper routines for creating objfile-owned types;
2c2fa1
    these correspond 1:1 to the already existing helper routines for creating
2c2fa1
    gdbarch-owned types, and are intended to be used instead of init_type.
2c2fa1
    A shared fragment of init_float_type and arch_float_type is extracted into
2c2fa1
    a separate subroutine verify_subroutine.
2c2fa1
    
2c2fa1
    The commit also brings the interface of init_type in line with the one for
2c2fa1
    arch_type.  In particular, this means removing the FLAGS argument; callers
2c2fa1
    now set the required flags directly.  (Since most callers use the new
2c2fa1
    helper routines, very few callers actually need to set any additional
2c2fa1
    flags directly any more.)
2c2fa1
    
2c2fa1
    Note that this means all the TYPE_FLAGS_... defined are no longer needed
2c2fa1
    anywhere; they will be removed by a follow-on commit.
2c2fa1
    
2c2fa1
    All users of init_type are changed to use on of the new helpers where
2c2fa1
    possible.  No functional change intended.
2c2fa1
    
2c2fa1
    gdb/ChangeLog:
2c2fa1
    
2c2fa1
            * gdbtypes.h (init_type): Remove FLAGS argument.  Move OBJFILE
2c2fa1
            argument to first position.
2c2fa1
            (init_integer_type): New prototype.
2c2fa1
            (init_character_type): Likewise.
2c2fa1
            (init_boolean_type): Likewise.
2c2fa1
            (init_float_type): Likewise.
2c2fa1
            (init_decfloat_type): Likewise.
2c2fa1
            (init_complex_type): Likewise.
2c2fa1
            (init_pointer_type): Likewise.
2c2fa1
            * gdbtypes.c (verify_floatflormat): New function.
2c2fa1
            (init_type): Remove FLAGS argument and processing.  Move OBJFILE
2c2fa1
            argument to first position.
2c2fa1
            (init_integer_type): New function.
2c2fa1
            (init_character_type): Likewise.
2c2fa1
            (init_boolean_type): Likewise.
2c2fa1
            (init_float_type): Likewise.
2c2fa1
            (init_decfloat_type): Likewise.
2c2fa1
            (init_complex_type): Likewise.
2c2fa1
            (init_pointer_type): Likewise.
2c2fa1
            (arch_float_type): Use verify_floatflormat.
2c2fa1
            (objfile_type): Use init_..._type helpers instead of calling
2c2fa1
            init_type directly.
2c2fa1
            * dwarf2read.c (fixup_go_packaging): Update to changed init_type
2c2fa1
            prototype.
2c2fa1
            (read_namespace_type): Likewise.
2c2fa1
            (read_module_type): Likewise.
2c2fa1
            (read_typedef): Likewise.
2c2fa1
            (read_unspecified_type): Likewise.
2c2fa1
            (build_error_marker_type): Likewise.
2c2fa1
            (read_base_type): Use init_..._type helpers.
2c2fa1
            * mdebugread.c (basic_type): Use init_..._type helpers.
2c2fa1
            (parse_type): Update to changed init_type prototype.
2c2fa1
            (cross_ref): Likewise.
2c2fa1
            * stabsread.c (rs6000_builtin_type): Use init_..._type helpers.
2c2fa1
            (read_sun_builtin_type): Likewise.
2c2fa1
            (read_sun_floating_type): Likewise.
2c2fa1
            (read_range_type): Likewise.  Also update to changed init_type
2c2fa1
            prototype.
2c2fa1
    
2c2fa1
    Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2c2fa1
2c2fa1
### a/gdb/ChangeLog
2c2fa1
### b/gdb/ChangeLog
2c2fa1
## -1,5 +1,46 @@
2c2fa1
 2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
2c2fa1
 
2c2fa1
+	* gdbtypes.h (init_type): Remove FLAGS argument.  Move OBJFILE
2c2fa1
+	argument to first position.
2c2fa1
+	(init_integer_type): New prototype.
2c2fa1
+	(init_character_type): Likewise.
2c2fa1
+	(init_boolean_type): Likewise.
2c2fa1
+	(init_float_type): Likewise.
2c2fa1
+	(init_decfloat_type): Likewise.
2c2fa1
+	(init_complex_type): Likewise.
2c2fa1
+	(init_pointer_type): Likewise.
2c2fa1
+	* gdbtypes.c (verify_floatflormat): New function.
2c2fa1
+	(init_type): Remove FLAGS argument and processing.  Move OBJFILE
2c2fa1
+	argument to first position.
2c2fa1
+	(init_integer_type): New function.
2c2fa1
+	(init_character_type): Likewise.
2c2fa1
+	(init_boolean_type): Likewise.
2c2fa1
+	(init_float_type): Likewise.
2c2fa1
+	(init_decfloat_type): Likewise.
2c2fa1
+	(init_complex_type): Likewise.
2c2fa1
+	(init_pointer_type): Likewise.
2c2fa1
+	(arch_float_type): Use verify_floatflormat.
2c2fa1
+	(objfile_type): Use init_..._type helpers instead of calling
2c2fa1
+	init_type directly.
2c2fa1
+	* dwarf2read.c (fixup_go_packaging): Update to changed init_type
2c2fa1
+	prototype.
2c2fa1
+	(read_namespace_type): Likewise.
2c2fa1
+	(read_module_type): Likewise.
2c2fa1
+	(read_typedef): Likewise.
2c2fa1
+	(read_unspecified_type): Likewise.
2c2fa1
+	(build_error_marker_type): Likewise.
2c2fa1
+	(read_base_type): Use init_..._type helpers.
2c2fa1
+	* mdebugread.c (basic_type): Use init_..._type helpers.
2c2fa1
+	(parse_type): Update to changed init_type prototype.
2c2fa1
+	(cross_ref): Likewise.
2c2fa1
+	* stabsread.c (rs6000_builtin_type): Use init_..._type helpers.
2c2fa1
+	(read_sun_builtin_type): Likewise.
2c2fa1
+	(read_sun_floating_type): Likewise.
2c2fa1
+	(read_range_type): Likewise.  Also update to changed init_type
2c2fa1
+	prototype.
2c2fa1
+
2c2fa1
+2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
2c2fa1
+
2c2fa1
 	* gdbtypes.h (arch_decfloat_type): New prototype.
2c2fa1
 	(arch_pointer_type): Likewise.
2c2fa1
 	* gdbtypes.c (arch_decfloat_type): New function.
2c2fa1
Index: gdb-7.6.1/gdb/dwarf2read.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/dwarf2read.c	2017-03-11 21:42:28.099262777 +0100
2c2fa1
+++ gdb-7.6.1/gdb/dwarf2read.c	2017-03-11 21:45:39.098565504 +0100
2c2fa1
@@ -6901,8 +6901,8 @@
2c2fa1
       const char *saved_package_name = obstack_copy0 (&objfile->objfile_obstack,
2c2fa1
 						      package_name,
2c2fa1
 						      strlen (package_name));
2c2fa1
-      struct type *type = init_type (TYPE_CODE_MODULE, 0, 0,
2c2fa1
-				     saved_package_name, objfile);
2c2fa1
+      struct type *type = init_type (objfile, TYPE_CODE_MODULE, 0,
2c2fa1
+				     saved_package_name);
2c2fa1
       struct symbol *sym;
2c2fa1
 
2c2fa1
       TYPE_TAG_NAME (type) = TYPE_NAME (type);
2c2fa1
@@ -12266,9 +12266,7 @@
2c2fa1
 			    previous_prefix, name, 0, cu);
2c2fa1
 
2c2fa1
   /* Create the type.  */
2c2fa1
-  type = init_type (TYPE_CODE_NAMESPACE, 0, 0, NULL,
2c2fa1
-		    objfile);
2c2fa1
-  TYPE_NAME (type) = name;
2c2fa1
+  type = init_type (objfile, TYPE_CODE_NAMESPACE, 0, name);
2c2fa1
   TYPE_TAG_NAME (type) = TYPE_NAME (type);
2c2fa1
 
2c2fa1
   return set_die_type (die, type, cu);
2c2fa1
@@ -12331,7 +12329,7 @@
2c2fa1
     complaint (&symfile_complaints,
2c2fa1
 	       _("DW_TAG_module has no name, offset 0x%x"),
2c2fa1
                die->offset.sect_off);
2c2fa1
-  type = init_type (TYPE_CODE_MODULE, 0, 0, module_name, objfile);
2c2fa1
+  type = init_type (objfile, TYPE_CODE_MODULE, 0, module_name);
2c2fa1
 
2c2fa1
   /* determine_prefix uses TYPE_TAG_NAME.  */
2c2fa1
   TYPE_TAG_NAME (type) = TYPE_NAME (type);
2c2fa1
@@ -12884,9 +12882,8 @@
2c2fa1
   struct type *this_type, *target_type;
2c2fa1
 
2c2fa1
   name = dwarf2_full_name (NULL, die, cu);
2c2fa1
-  this_type = init_type (TYPE_CODE_TYPEDEF, 0,
2c2fa1
-			 TYPE_FLAG_TARGET_STUB, NULL, objfile);
2c2fa1
-  TYPE_NAME (this_type) = name;
2c2fa1
+  this_type = init_type (objfile, TYPE_CODE_TYPEDEF, 0, name);
2c2fa1
+  TYPE_TARGET_STUB (this_type) = 1;
2c2fa1
   set_die_type (die, this_type, cu);
2c2fa1
   target_type = die_type (die, cu);
2c2fa1
   if (target_type != this_type)
2c2fa1
@@ -12913,11 +12910,8 @@
2c2fa1
   struct objfile *objfile = cu->objfile;
2c2fa1
   struct type *type;
2c2fa1
   struct attribute *attr;
2c2fa1
-  int encoding = 0, size = 0;
2c2fa1
+  int encoding = 0, bits = 0;
2c2fa1
   const char *name;
2c2fa1
-  enum type_code code = TYPE_CODE_INT;
2c2fa1
-  int type_flags = 0;
2c2fa1
-  struct type *target_type = NULL;
2c2fa1
 
2c2fa1
   attr = dwarf2_attr (die, DW_AT_encoding, cu);
2c2fa1
   if (attr)
2c2fa1
@@ -12927,7 +12921,7 @@
2c2fa1
   attr = dwarf2_attr (die, DW_AT_byte_size, cu);
2c2fa1
   if (attr)
2c2fa1
     {
2c2fa1
-      size = DW_UNSND (attr);
2c2fa1
+      bits = DW_UNSND (attr) * TARGET_CHAR_BIT;
2c2fa1
     }
2c2fa1
   name = dwarf2_name (die, cu);
2c2fa1
   if (!name)
2c2fa1
@@ -12940,61 +12934,63 @@
2c2fa1
     {
2c2fa1
       case DW_ATE_address:
2c2fa1
 	/* Turn DW_ATE_address into a void * pointer.  */
2c2fa1
-	code = TYPE_CODE_PTR;
2c2fa1
-	type_flags |= TYPE_FLAG_UNSIGNED;
2c2fa1
-	target_type = init_type (TYPE_CODE_VOID, 1, 0, NULL, objfile);
2c2fa1
+	type = init_type (objfile, TYPE_CODE_VOID, 1, NULL);
2c2fa1
+	type = init_pointer_type (objfile, bits, name, type);
2c2fa1
 	break;
2c2fa1
       case DW_ATE_boolean:
2c2fa1
-	code = TYPE_CODE_BOOL;
2c2fa1
-	type_flags |= TYPE_FLAG_UNSIGNED;
2c2fa1
+	type = init_boolean_type (objfile, bits, 1, name);
2c2fa1
 	break;
2c2fa1
       case DW_ATE_complex_float:
2c2fa1
-	code = TYPE_CODE_COMPLEX;
2c2fa1
-	target_type = init_type (TYPE_CODE_FLT, size / 2, 0, NULL, objfile);
2c2fa1
+	type = init_float_type (objfile, bits / 2, NULL, NULL);
2c2fa1
+	type = init_complex_type (objfile, name, type);
2c2fa1
 	break;
2c2fa1
       case DW_ATE_decimal_float:
2c2fa1
-	code = TYPE_CODE_DECFLOAT;
2c2fa1
+	type = init_decfloat_type (objfile, bits, name);
2c2fa1
 	break;
2c2fa1
       case DW_ATE_float:
2c2fa1
-	code = TYPE_CODE_FLT;
2c2fa1
+	type = init_float_type (objfile, bits, name, NULL);
2c2fa1
 	break;
2c2fa1
       case DW_ATE_signed:
2c2fa1
+	type = init_integer_type (objfile, bits, 0, name);
2c2fa1
 	break;
2c2fa1
       case DW_ATE_unsigned:
2c2fa1
-	type_flags |= TYPE_FLAG_UNSIGNED;
2c2fa1
 	if (cu->language == language_fortran
2c2fa1
 	    && name
2c2fa1
 	    && strncmp (name, "character(", sizeof ("character(") - 1) == 0)
2c2fa1
-	  code = TYPE_CODE_CHAR;
2c2fa1
+	  type = init_character_type (objfile, bits, 1, name);
2c2fa1
+	else
2c2fa1
+	  type = init_integer_type (objfile, bits, 1, name);
2c2fa1
 	break;
2c2fa1
       case DW_ATE_signed_char:
2c2fa1
 	if (cu->language == language_ada || cu->language == language_m2
2c2fa1
 	    || cu->language == language_pascal
2c2fa1
 	    || cu->language == language_fortran)
2c2fa1
-	  code = TYPE_CODE_CHAR;
2c2fa1
+	  type = init_character_type (objfile, bits, 0, name);
2c2fa1
+	else
2c2fa1
+	  type = init_integer_type (objfile, bits, 0, name);
2c2fa1
 	break;
2c2fa1
       case DW_ATE_unsigned_char:
2c2fa1
 	if (cu->language == language_ada || cu->language == language_m2
2c2fa1
 	    || cu->language == language_pascal
2c2fa1
 	    || cu->language == language_fortran)
2c2fa1
-	  code = TYPE_CODE_CHAR;
2c2fa1
-	type_flags |= TYPE_FLAG_UNSIGNED;
2c2fa1
+	  type = init_character_type (objfile, bits, 1, name);
2c2fa1
+	else
2c2fa1
+	  type = init_integer_type (objfile, bits, 1, name);
2c2fa1
 	break;
2c2fa1
       case DW_ATE_UTF:
2c2fa1
 	/* We just treat this as an integer and then recognize the
2c2fa1
 	   type by name elsewhere.  */
2c2fa1
+	type = init_integer_type (objfile, bits, 0, name);
2c2fa1
 	break;
2c2fa1
 
2c2fa1
       default:
2c2fa1
 	complaint (&symfile_complaints, _("unsupported DW_AT_encoding: '%s'"),
2c2fa1
 		   dwarf_type_encoding_name (encoding));
2c2fa1
+	type = init_type (objfile, TYPE_CODE_ERROR,
2c2fa1
+			  bits / TARGET_CHAR_BIT, name);
2c2fa1
 	break;
2c2fa1
     }
2c2fa1
 
2c2fa1
-  type = init_type (code, size, type_flags, NULL, objfile);
2c2fa1
-  TYPE_NAME (type) = name;
2c2fa1
-  TYPE_TARGET_TYPE (type) = target_type;
2c2fa1
-
2c2fa1
   if (name && strcmp (name, "char") == 0)
2c2fa1
     TYPE_NOSIGN (type) = 1;
2c2fa1
 
2c2fa1
@@ -13287,7 +13283,7 @@
2c2fa1
 
2c2fa1
   /* For now, we only support the C meaning of an unspecified type: void.  */
2c2fa1
 
2c2fa1
-  type = init_type (TYPE_CODE_VOID, 0, 0, NULL, cu->objfile);
2c2fa1
+  type = init_type (cu->objfile, TYPE_CODE_VOID, 0, NULL);
2c2fa1
   TYPE_NAME (type) = dwarf2_name (die, cu);
2c2fa1
 
2c2fa1
   return set_die_type (die, type, cu);
2c2fa1
@@ -16913,7 +16909,7 @@
2c2fa1
 			     message, strlen (message));
2c2fa1
       xfree (message);
2c2fa1
 
2c2fa1
-      this_type = init_type (TYPE_CODE_ERROR, 0, 0, saved, objfile);
2c2fa1
+      this_type = init_type (objfile, TYPE_CODE_ERROR, 0, saved);
2c2fa1
     }
2c2fa1
 
2c2fa1
   return this_type;
2c2fa1
Index: gdb-7.6.1/gdb/gdbtypes.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/gdbtypes.c	2017-03-11 21:45:27.194484312 +0100
2c2fa1
+++ gdb-7.6.1/gdb/gdbtypes.c	2017-03-11 21:48:13.551598067 +0100
2c2fa1
@@ -2107,6 +2107,41 @@
2c2fa1
     }
2c2fa1
 }
2c2fa1
 
2c2fa1
+// RH
2c2fa1
+#define FLOATFORMAT_CHAR_BIT 8 // doublest.c
2c2fa1
+static size_t
2c2fa1
+floatformat_totalsize_bytes (const struct floatformat *fmt)
2c2fa1
+{
2c2fa1
+  return ((fmt->totalsize + FLOATFORMAT_CHAR_BIT - 1)
2c2fa1
+          / FLOATFORMAT_CHAR_BIT);
2c2fa1
+}
2c2fa1
+
2c2fa1
+/* Helper function to verify floating-point format and size.
2c2fa1
+   BIT is the type size in bits; if BIT equals -1, the size is
2c2fa1
+   determined by the floatformat.  Returns size to be used.  */
2c2fa1
+
2c2fa1
+static int
2c2fa1
+verify_floatformat (int bit, const struct floatformat **floatformats)
2c2fa1
+{
2c2fa1
+  if (bit == -1)
2c2fa1
+    {
2c2fa1
+      gdb_assert (floatformats != NULL);
2c2fa1
+      gdb_assert (floatformats[0] != NULL && floatformats[1] != NULL);
2c2fa1
+      bit = floatformats[0]->totalsize;
2c2fa1
+    }
2c2fa1
+  gdb_assert (bit >= 0);
2c2fa1
+
2c2fa1
+  if (floatformats != NULL)
2c2fa1
+    {
2c2fa1
+      size_t len = bit / TARGET_CHAR_BIT;
2c2fa1
+
2c2fa1
+      gdb_assert (len >= floatformat_totalsize_bytes (floatformats[0]));
2c2fa1
+      gdb_assert (len >= floatformat_totalsize_bytes (floatformats[1]));
2c2fa1
+    }
2c2fa1
+
2c2fa1
+  return bit;
2c2fa1
+}
2c2fa1
+
2c2fa1
 /* Helper function to initialize the standard scalar types.
2c2fa1
 
2c2fa1
    If NAME is non-NULL, then it is used to initialize the type name.
2c2fa1
@@ -2114,8 +2149,8 @@
2c2fa1
    least as long as OBJFILE.  */
2c2fa1
 
2c2fa1
 struct type *
2c2fa1
-init_type (enum type_code code, LONGEST length, int flags,
2c2fa1
-	   const char *name, struct objfile *objfile)
2c2fa1
+init_type (struct objfile *objfile, enum type_code code, LONGEST length,
2c2fa1
+	   const char *name)
2c2fa1
 {
2c2fa1
   struct type *type;
2c2fa1
 
2c2fa1
@@ -2123,32 +2158,6 @@
2c2fa1
   set_type_code (type, code);
2c2fa1
   TYPE_LENGTH (type) = length;
2c2fa1
 
2c2fa1
-  gdb_assert (!(flags & (TYPE_FLAG_MIN - 1)));
2c2fa1
-  if (flags & TYPE_FLAG_UNSIGNED)
2c2fa1
-    TYPE_UNSIGNED (type) = 1;
2c2fa1
-  if (flags & TYPE_FLAG_NOSIGN)
2c2fa1
-    TYPE_NOSIGN (type) = 1;
2c2fa1
-  if (flags & TYPE_FLAG_STUB)
2c2fa1
-    TYPE_STUB (type) = 1;
2c2fa1
-  if (flags & TYPE_FLAG_TARGET_STUB)
2c2fa1
-    TYPE_TARGET_STUB (type) = 1;
2c2fa1
-  if (flags & TYPE_FLAG_STATIC)
2c2fa1
-    TYPE_STATIC (type) = 1;
2c2fa1
-  if (flags & TYPE_FLAG_PROTOTYPED)
2c2fa1
-    TYPE_PROTOTYPED (type) = 1;
2c2fa1
-  if (flags & TYPE_FLAG_INCOMPLETE)
2c2fa1
-    TYPE_INCOMPLETE (type) = 1;
2c2fa1
-  if (flags & TYPE_FLAG_VARARGS)
2c2fa1
-    TYPE_VARARGS (type) = 1;
2c2fa1
-  if (flags & TYPE_FLAG_VECTOR)
2c2fa1
-    TYPE_VECTOR (type) = 1;
2c2fa1
-  if (flags & TYPE_FLAG_STUB_SUPPORTED)
2c2fa1
-    TYPE_STUB_SUPPORTED (type) = 1;
2c2fa1
-  if (flags & TYPE_FLAG_FIXED_INSTANCE)
2c2fa1
-    TYPE_FIXED_INSTANCE (type) = 1;
2c2fa1
-  if (flags & TYPE_FLAG_GNU_IFUNC)
2c2fa1
-    TYPE_GNU_IFUNC (type) = 1;
2c2fa1
-
2c2fa1
   TYPE_NAME (type) = name;
2c2fa1
 
2c2fa1
   /* C++ fancies.  */
2c2fa1
@@ -2158,6 +2167,121 @@
2c2fa1
 
2c2fa1
   return type;
2c2fa1
 }
2c2fa1
+
2c2fa1
+/* Allocate a TYPE_CODE_INT type structure associated with OBJFILE.
2c2fa1
+   BIT is the type size in bits.  If UNSIGNED_P is non-zero, set
2c2fa1
+   the type's TYPE_UNSIGNED flag.  NAME is the type name.  */
2c2fa1
+
2c2fa1
+struct type *
2c2fa1
+init_integer_type (struct objfile *objfile,
2c2fa1
+		   int bit, int unsigned_p, const char *name)
2c2fa1
+{
2c2fa1
+  struct type *t;
2c2fa1
+
2c2fa1
+  t = init_type (objfile, TYPE_CODE_INT, bit / TARGET_CHAR_BIT, name);
2c2fa1
+  if (unsigned_p)
2c2fa1
+    TYPE_UNSIGNED (t) = 1;
2c2fa1
+
2c2fa1
+  return t;
2c2fa1
+}
2c2fa1
+
2c2fa1
+/* Allocate a TYPE_CODE_CHAR type structure associated with OBJFILE.
2c2fa1
+   BIT is the type size in bits.  If UNSIGNED_P is non-zero, set
2c2fa1
+   the type's TYPE_UNSIGNED flag.  NAME is the type name.  */
2c2fa1
+
2c2fa1
+struct type *
2c2fa1
+init_character_type (struct objfile *objfile,
2c2fa1
+		     int bit, int unsigned_p, const char *name)
2c2fa1
+{
2c2fa1
+  struct type *t;
2c2fa1
+
2c2fa1
+  t = init_type (objfile, TYPE_CODE_CHAR, bit / TARGET_CHAR_BIT, name);
2c2fa1
+  if (unsigned_p)
2c2fa1
+    TYPE_UNSIGNED (t) = 1;
2c2fa1
+
2c2fa1
+  return t;
2c2fa1
+}
2c2fa1
+
2c2fa1
+/* Allocate a TYPE_CODE_BOOL type structure associated with OBJFILE.
2c2fa1
+   BIT is the type size in bits.  If UNSIGNED_P is non-zero, set
2c2fa1
+   the type's TYPE_UNSIGNED flag.  NAME is the type name.  */
2c2fa1
+
2c2fa1
+struct type *
2c2fa1
+init_boolean_type (struct objfile *objfile,
2c2fa1
+		   int bit, int unsigned_p, const char *name)
2c2fa1
+{
2c2fa1
+  struct type *t;
2c2fa1
+
2c2fa1
+  t = init_type (objfile, TYPE_CODE_BOOL, bit / TARGET_CHAR_BIT, name);
2c2fa1
+  if (unsigned_p)
2c2fa1
+    TYPE_UNSIGNED (t) = 1;
2c2fa1
+
2c2fa1
+  return t;
2c2fa1
+}
2c2fa1
+
2c2fa1
+/* Allocate a TYPE_CODE_FLT type structure associated with OBJFILE.
2c2fa1
+   BIT is the type size in bits; if BIT equals -1, the size is
2c2fa1
+   determined by the floatformat.  NAME is the type name.  Set the
2c2fa1
+   TYPE_FLOATFORMAT from FLOATFORMATS.  */
2c2fa1
+
2c2fa1
+struct type *
2c2fa1
+init_float_type (struct objfile *objfile,
2c2fa1
+		 int bit, const char *name,
2c2fa1
+		 const struct floatformat **floatformats)
2c2fa1
+{
2c2fa1
+  struct type *t;
2c2fa1
+
2c2fa1
+  bit = verify_floatformat (bit, floatformats);
2c2fa1
+  t = init_type (objfile, TYPE_CODE_FLT, bit / TARGET_CHAR_BIT, name);
2c2fa1
+  TYPE_FLOATFORMAT (t) = floatformats;
2c2fa1
+
2c2fa1
+  return t;
2c2fa1
+}
2c2fa1
+
2c2fa1
+/* Allocate a TYPE_CODE_DECFLOAT type structure associated with OBJFILE.
2c2fa1
+   BIT is the type size in bits.  NAME is the type name.  */
2c2fa1
+
2c2fa1
+struct type *
2c2fa1
+init_decfloat_type (struct objfile *objfile, int bit, const char *name)
2c2fa1
+{
2c2fa1
+  struct type *t;
2c2fa1
+
2c2fa1
+  t = init_type (objfile, TYPE_CODE_DECFLOAT, bit / TARGET_CHAR_BIT, name);
2c2fa1
+  return t;
2c2fa1
+}
2c2fa1
+
2c2fa1
+/* Allocate a TYPE_CODE_COMPLEX type structure associated with OBJFILE.
2c2fa1
+   NAME is the type name.  TARGET_TYPE is the component float type.  */
2c2fa1
+
2c2fa1
+struct type *
2c2fa1
+init_complex_type (struct objfile *objfile,
2c2fa1
+		   const char *name, struct type *target_type)
2c2fa1
+{
2c2fa1
+  struct type *t;
2c2fa1
+
2c2fa1
+  t = init_type (objfile, TYPE_CODE_COMPLEX,
2c2fa1
+		 2 * TYPE_LENGTH (target_type), name);
2c2fa1
+  TYPE_TARGET_TYPE (t) = target_type;
2c2fa1
+  return t;
2c2fa1
+}
2c2fa1
+
2c2fa1
+/* Allocate a TYPE_CODE_PTR type structure associated with OBJFILE.
2c2fa1
+   BIT is the pointer type size in bits.  NAME is the type name.
2c2fa1
+   TARGET_TYPE is the pointer target type.  Always sets the pointer type's
2c2fa1
+   TYPE_UNSIGNED flag.  */
2c2fa1
+
2c2fa1
+struct type *
2c2fa1
+init_pointer_type (struct objfile *objfile,
2c2fa1
+		   int bit, const char *name, struct type *target_type)
2c2fa1
+{
2c2fa1
+  struct type *t;
2c2fa1
+
2c2fa1
+  t = init_type (objfile, TYPE_CODE_PTR, bit / TARGET_CHAR_BIT, name);
2c2fa1
+  TYPE_TARGET_TYPE (t) = target_type;
2c2fa1
+  TYPE_UNSIGNED (t) = 1;
2c2fa1
+  return t;
2c2fa1
+}
2c2fa1
+
2c2fa1
 
2c2fa1
 /* Queries on types.  */
2c2fa1
 
2c2fa1
@@ -4010,14 +4134,7 @@
2c2fa1
 {
2c2fa1
   struct type *t;
2c2fa1
 
2c2fa1
-  if (bit == -1)
2c2fa1
-    {
2c2fa1
-      gdb_assert (floatformats != NULL);
2c2fa1
-      gdb_assert (floatformats[0] != NULL && floatformats[1] != NULL);
2c2fa1
-      bit = floatformats[0]->totalsize;
2c2fa1
-    }
2c2fa1
-  gdb_assert (bit >= 0);
2c2fa1
-
2c2fa1
+  bit = verify_floatformat (bit, floatformats);
2c2fa1
   t = arch_type (gdbarch, TYPE_CODE_FLT, bit / TARGET_CHAR_BIT, name);
2c2fa1
   TYPE_FLOATFORMAT (t) = floatformats;
2c2fa1
   return t;
2c2fa1
@@ -4350,109 +4467,80 @@
2c2fa1
 
2c2fa1
   /* Basic types.  */
2c2fa1
   objfile_type->builtin_void
2c2fa1
-    = init_type (TYPE_CODE_VOID, 1,
2c2fa1
-		 0,
2c2fa1
-		 "void", objfile);
2c2fa1
-
2c2fa1
+    = init_type (objfile, TYPE_CODE_VOID, 1, "void");
2c2fa1
   objfile_type->builtin_char
2c2fa1
-    = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
2c2fa1
-		 (TYPE_FLAG_NOSIGN
2c2fa1
-		  | (gdbarch_char_signed (gdbarch) ? 0 : TYPE_FLAG_UNSIGNED)),
2c2fa1
-		 "char", objfile);
2c2fa1
+    = init_integer_type (objfile, TARGET_CHAR_BIT,
2c2fa1
+			 !gdbarch_char_signed (gdbarch), "char");
2c2fa1
   objfile_type->builtin_signed_char
2c2fa1
-    = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
2c2fa1
-		 0,
2c2fa1
-		 "signed char", objfile);
2c2fa1
+    = init_integer_type (objfile, TARGET_CHAR_BIT,
2c2fa1
+			 0, "signed char");
2c2fa1
   objfile_type->builtin_unsigned_char
2c2fa1
-    = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
2c2fa1
-		 TYPE_FLAG_UNSIGNED,
2c2fa1
-		 "unsigned char", objfile);
2c2fa1
+    = init_integer_type (objfile, TARGET_CHAR_BIT,
2c2fa1
+			 1, "unsigned char");
2c2fa1
   objfile_type->builtin_short
2c2fa1
-    = init_type (TYPE_CODE_INT,
2c2fa1
-		 gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
2c2fa1
-		 0, "short", objfile);
2c2fa1
+    = init_integer_type (objfile, gdbarch_short_bit (gdbarch),
2c2fa1
+			 0, "short");
2c2fa1
   objfile_type->builtin_unsigned_short
2c2fa1
-    = init_type (TYPE_CODE_INT,
2c2fa1
-		 gdbarch_short_bit (gdbarch) / TARGET_CHAR_BIT,
2c2fa1
-		 TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
2c2fa1
+    = init_integer_type (objfile, gdbarch_short_bit (gdbarch),
2c2fa1
+			 1, "unsigned short");
2c2fa1
   objfile_type->builtin_int
2c2fa1
-    = init_type (TYPE_CODE_INT,
2c2fa1
-		 gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
2c2fa1
-		 0, "int", objfile);
2c2fa1
+    = init_integer_type (objfile, gdbarch_int_bit (gdbarch),
2c2fa1
+			 0, "int");
2c2fa1
   objfile_type->builtin_unsigned_int
2c2fa1
-    = init_type (TYPE_CODE_INT,
2c2fa1
-		 gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
2c2fa1
-		 TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
2c2fa1
+    = init_integer_type (objfile, gdbarch_int_bit (gdbarch),
2c2fa1
+			 1, "unsigned int");
2c2fa1
   objfile_type->builtin_long
2c2fa1
-    = init_type (TYPE_CODE_INT,
2c2fa1
-		 gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
2c2fa1
-		 0, "long", objfile);
2c2fa1
+    = init_integer_type (objfile, gdbarch_long_bit (gdbarch),
2c2fa1
+			 0, "long");
2c2fa1
   objfile_type->builtin_unsigned_long
2c2fa1
-    = init_type (TYPE_CODE_INT,
2c2fa1
-		 gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT,
2c2fa1
-		 TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
2c2fa1
+    = init_integer_type (objfile, gdbarch_long_bit (gdbarch),
2c2fa1
+			 1, "unsigned long");
2c2fa1
   objfile_type->builtin_long_long
2c2fa1
-    = init_type (TYPE_CODE_INT,
2c2fa1
-		 gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
2c2fa1
-		 0, "long long", objfile);
2c2fa1
+    = init_integer_type (objfile, gdbarch_long_long_bit (gdbarch),
2c2fa1
+			 0, "long long");
2c2fa1
   objfile_type->builtin_unsigned_long_long
2c2fa1
-    = init_type (TYPE_CODE_INT,
2c2fa1
-		 gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT,
2c2fa1
-		 TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
2c2fa1
-
2c2fa1
+    = init_integer_type (objfile, gdbarch_long_long_bit (gdbarch),
2c2fa1
+			 1, "unsigned long long");
2c2fa1
   objfile_type->builtin_float
2c2fa1
-    = init_type (TYPE_CODE_FLT,
2c2fa1
-		 gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
2c2fa1
-		 0, "float", objfile);
2c2fa1
-  TYPE_FLOATFORMAT (objfile_type->builtin_float)
2c2fa1
-    = gdbarch_float_format (gdbarch);
2c2fa1
+    = init_float_type (objfile, gdbarch_float_bit (gdbarch),
2c2fa1
+		       "float", gdbarch_float_format (gdbarch));
2c2fa1
   objfile_type->builtin_double
2c2fa1
-    = init_type (TYPE_CODE_FLT,
2c2fa1
-		 gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
2c2fa1
-		 0, "double", objfile);
2c2fa1
-  TYPE_FLOATFORMAT (objfile_type->builtin_double)
2c2fa1
-    = gdbarch_double_format (gdbarch);
2c2fa1
+    = init_float_type (objfile, gdbarch_double_bit (gdbarch),
2c2fa1
+		       "double", gdbarch_double_format (gdbarch));
2c2fa1
   objfile_type->builtin_long_double
2c2fa1
-    = init_type (TYPE_CODE_FLT,
2c2fa1
-		 gdbarch_long_double_bit (gdbarch) / TARGET_CHAR_BIT,
2c2fa1
-		 0, "long double", objfile);
2c2fa1
-  TYPE_FLOATFORMAT (objfile_type->builtin_long_double)
2c2fa1
-    = gdbarch_long_double_format (gdbarch);
2c2fa1
+    = init_float_type (objfile, gdbarch_long_double_bit (gdbarch),
2c2fa1
+		       "long double", gdbarch_long_double_format (gdbarch));
2c2fa1
 
2c2fa1
   /* This type represents a type that was unrecognized in symbol read-in.  */
2c2fa1
   objfile_type->builtin_error
2c2fa1
-    = init_type (TYPE_CODE_ERROR, 0, 0, "<unknown type>", objfile);
2c2fa1
+    = init_type (objfile, TYPE_CODE_ERROR, 0, "<unknown type>");
2c2fa1
 
2c2fa1
   /* The following set of types is used for symbols with no
2c2fa1
      debug information.  */
2c2fa1
   objfile_type->nodebug_text_symbol
2c2fa1
-    = init_type (TYPE_CODE_FUNC, 1, 0,
2c2fa1
-		 "<text variable, no debug info>", objfile);
2c2fa1
+    = init_type (objfile, TYPE_CODE_FUNC, 1,
2c2fa1
+		 "<text variable, no debug info>");
2c2fa1
   TYPE_TARGET_TYPE (objfile_type->nodebug_text_symbol)
2c2fa1
     = objfile_type->builtin_int;
2c2fa1
   objfile_type->nodebug_text_gnu_ifunc_symbol
2c2fa1
-    = init_type (TYPE_CODE_FUNC, 1, TYPE_FLAG_GNU_IFUNC,
2c2fa1
-		 "<text gnu-indirect-function variable, no debug info>",
2c2fa1
-		 objfile);
2c2fa1
+    = init_type (objfile, TYPE_CODE_FUNC, 1,
2c2fa1
+		 "<text gnu-indirect-function variable, no debug info>");
2c2fa1
   TYPE_TARGET_TYPE (objfile_type->nodebug_text_gnu_ifunc_symbol)
2c2fa1
     = objfile_type->nodebug_text_symbol;
2c2fa1
+  TYPE_GNU_IFUNC (objfile_type->nodebug_text_gnu_ifunc_symbol) = 1;
2c2fa1
   objfile_type->nodebug_got_plt_symbol
2c2fa1
-    = init_type (TYPE_CODE_PTR, gdbarch_addr_bit (gdbarch) / 8, 0,
2c2fa1
-		 "<text from jump slot in .got.plt, no debug info>",
2c2fa1
-		 objfile);
2c2fa1
-  TYPE_TARGET_TYPE (objfile_type->nodebug_got_plt_symbol)
2c2fa1
-    = objfile_type->nodebug_text_symbol;
2c2fa1
+    = init_pointer_type (objfile, gdbarch_addr_bit (gdbarch),
2c2fa1
+			 "<text from jump slot in .got.plt, no debug info>",
2c2fa1
+			 objfile_type->nodebug_text_symbol);
2c2fa1
   objfile_type->nodebug_data_symbol
2c2fa1
-    = init_type (TYPE_CODE_INT,
2c2fa1
-		 gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
2c2fa1
-		 "<data variable, no debug info>", objfile);
2c2fa1
+    = init_integer_type (objfile, gdbarch_int_bit (gdbarch), 0,
2c2fa1
+			 "<data variable, no debug info>");
2c2fa1
   objfile_type->nodebug_unknown_symbol
2c2fa1
-    = init_type (TYPE_CODE_INT, 1, 0,
2c2fa1
-		 "<variable (not text or data), no debug info>", objfile);
2c2fa1
+    = init_integer_type (objfile, TARGET_CHAR_BIT, 0,
2c2fa1
+			 "<variable (not text or data), no debug info>");
2c2fa1
   objfile_type->nodebug_tls_symbol
2c2fa1
-    = init_type (TYPE_CODE_INT,
2c2fa1
-		 gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
2c2fa1
-		 "<thread local variable, no debug info>", objfile);
2c2fa1
+    = init_integer_type (objfile, gdbarch_int_bit (gdbarch), 0,
2c2fa1
+			 "<thread local variable, no debug info>");
2c2fa1
 
2c2fa1
   /* NOTE: on some targets, addresses and pointers are not necessarily
2c2fa1
      the same --- for example, on the D10V, pointers are 16 bits long,
2c2fa1
@@ -4482,9 +4570,8 @@
2c2fa1
      are indeed in the unified virtual address space.  */
2c2fa1
 
2c2fa1
   objfile_type->builtin_core_addr
2c2fa1
-    = init_type (TYPE_CODE_INT,
2c2fa1
-		 gdbarch_addr_bit (gdbarch) / 8,
2c2fa1
-		 TYPE_FLAG_UNSIGNED, "__CORE_ADDR", objfile);
2c2fa1
+    = init_integer_type (objfile, gdbarch_addr_bit (gdbarch), 1,
2c2fa1
+			 "__CORE_ADDR");
2c2fa1
 
2c2fa1
   set_objfile_data (objfile, objfile_type_data, objfile_type);
2c2fa1
   return objfile_type;
2c2fa1
Index: gdb-7.6.1/gdb/gdbtypes.h
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/gdbtypes.h	2017-03-11 21:45:27.194484312 +0100
2c2fa1
+++ gdb-7.6.1/gdb/gdbtypes.h	2017-03-11 21:45:39.100565518 +0100
2c2fa1
@@ -1542,8 +1542,21 @@
2c2fa1
 extern struct gdbarch *get_type_arch (const struct type *);
2c2fa1
 
2c2fa1
 /* Helper function to construct objfile-owned types.  */
2c2fa1
-extern struct type *init_type (enum type_code, LONGEST, int, const char *,
2c2fa1
-			       struct objfile *);
2c2fa1
+extern struct type *init_type (struct objfile *, enum type_code, LONGEST,
2c2fa1
+			       const char *);
2c2fa1
+extern struct type *init_integer_type (struct objfile *, int, int,
2c2fa1
+				       const char *);
2c2fa1
+extern struct type *init_character_type (struct objfile *, int, int,
2c2fa1
+					 const char *);
2c2fa1
+extern struct type *init_boolean_type (struct objfile *, int, int,
2c2fa1
+				       const char *);
2c2fa1
+extern struct type *init_float_type (struct objfile *, int, const char *,
2c2fa1
+				     const struct floatformat **);
2c2fa1
+extern struct type *init_decfloat_type (struct objfile *, int, const char *);
2c2fa1
+extern struct type *init_complex_type (struct objfile *, const char *,
2c2fa1
+				       struct type *);
2c2fa1
+extern struct type *init_pointer_type (struct objfile *, int, const char *,
2c2fa1
+				       struct type *);
2c2fa1
 
2c2fa1
 /* Helper functions to construct architecture-owned types.  */
2c2fa1
 extern struct type *arch_type (struct gdbarch *, enum type_code, LONGEST,
2c2fa1
Index: gdb-7.6.1/gdb/mdebugread.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/mdebugread.c	2017-03-11 21:42:28.099262777 +0100
2c2fa1
+++ gdb-7.6.1/gdb/mdebugread.c	2017-03-11 21:45:39.101565525 +0100
2c2fa1
@@ -1374,97 +1374,80 @@
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btAdr:
2c2fa1
-      tp = init_type (TYPE_CODE_PTR, 4, TYPE_FLAG_UNSIGNED,
2c2fa1
-		      "adr_32", objfile);
2c2fa1
-      TYPE_TARGET_TYPE (tp) = objfile_type (objfile)->builtin_void;
2c2fa1
+      tp = init_pointer_type (objfile, 32, "adr_32",
2c2fa1
+			      objfile_type (objfile)->builtin_void);
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btChar:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 1, 0,
2c2fa1
-		      "char", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 8, 0, "char");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btUChar:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED,
2c2fa1
-		      "unsigned char", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 8, 1, "unsigned char");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btShort:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 2, 0,
2c2fa1
-		      "short", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 16, 0, "short");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btUShort:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED,
2c2fa1
-		      "unsigned short", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 16, 1, "unsigned short");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btInt:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 4, 0,
2c2fa1
-		      "int", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 32, 0, "int");
2c2fa1
       break;
2c2fa1
 
2c2fa1
    case btUInt:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
2c2fa1
-		      "unsigned int", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 32, 1, "unsigned int");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btLong:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 4, 0,
2c2fa1
-		      "long", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 32, 0, "long");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btULong:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
2c2fa1
-		      "unsigned long", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 32, 1, "unsigned long");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btFloat:
2c2fa1
-      tp = init_type (TYPE_CODE_FLT,
2c2fa1
-		      gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT, 0,
2c2fa1
-		      "float", objfile);
2c2fa1
+      tp = init_float_type (objfile, gdbarch_float_bit (gdbarch),
2c2fa1
+			    "float", NULL);
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btDouble:
2c2fa1
-      tp = init_type (TYPE_CODE_FLT,
2c2fa1
-		      gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT, 0,
2c2fa1
-		      "double", objfile);
2c2fa1
+      tp = init_float_type (objfile, gdbarch_double_bit (gdbarch),
2c2fa1
+			    "double", NULL);
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btComplex:
2c2fa1
-      tp = init_type (TYPE_CODE_COMPLEX,
2c2fa1
-		      2 * gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT, 0,
2c2fa1
-		      "complex", objfile);
2c2fa1
-      TYPE_TARGET_TYPE (tp) = basic_type (btFloat, objfile);
2c2fa1
+      tp = init_complex_type (objfile, "complex",
2c2fa1
+			      basic_type (btFloat, objfile));
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btDComplex:
2c2fa1
-      tp = init_type (TYPE_CODE_COMPLEX,
2c2fa1
-		      2 * gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT, 0,
2c2fa1
-		      "double complex", objfile);
2c2fa1
-      TYPE_TARGET_TYPE (tp) = basic_type (btDouble, objfile);
2c2fa1
+      tp = init_complex_type (objfile, "double complex",
2c2fa1
+			      basic_type (btFloat, objfile));
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btFixedDec:
2c2fa1
       /* We use TYPE_CODE_INT to print these as integers.  Does this do any
2c2fa1
 	 good?  Would we be better off with TYPE_CODE_ERROR?  Should
2c2fa1
 	 TYPE_CODE_ERROR print things in hex if it knows the size?  */
2c2fa1
-      tp = init_type (TYPE_CODE_INT,
2c2fa1
-		      gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT, 0,
2c2fa1
-		      "fixed decimal", objfile);
2c2fa1
+      tp = init_integer_type (objfile, gdbarch_int_bit (gdbarch), 0,
2c2fa1
+			      "fixed decimal");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btFloatDec:
2c2fa1
-      tp = init_type (TYPE_CODE_ERROR,
2c2fa1
-		      gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT, 0,
2c2fa1
-		      "floating decimal", objfile);
2c2fa1
+      tp = init_type (objfile, TYPE_CODE_ERROR,
2c2fa1
+		      gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT,
2c2fa1
+		      "floating decimal");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btString:
2c2fa1
       /* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
2c2fa1
 	 FIXME.  */
2c2fa1
-      tp = init_type (TYPE_CODE_STRING, 1, 0,
2c2fa1
-		      "string", objfile);
2c2fa1
+      tp = init_type (objfile, TYPE_CODE_STRING, 1, "string");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btVoid:
2c2fa1
@@ -1472,39 +1455,32 @@
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btLong64:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 8, 0,
2c2fa1
-		      "long", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 64, 0, "long");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btULong64:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
2c2fa1
-		      "unsigned long", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 64, 1, "unsigned long");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btLongLong64:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 8, 0,
2c2fa1
-		      "long long", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 64, 0, "long long");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btULongLong64:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
2c2fa1
-		      "unsigned long long", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 64, 1, "unsigned long long");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btAdr64:
2c2fa1
-      tp = init_type (TYPE_CODE_PTR, 8, TYPE_FLAG_UNSIGNED,
2c2fa1
-		      "adr_64", objfile);
2c2fa1
-      TYPE_TARGET_TYPE (tp) = objfile_type (objfile)->builtin_void;
2c2fa1
+      tp = init_pointer_type (objfile, 64, "adr_64",
2c2fa1
+			      objfile_type (objfile)->builtin_void);
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btInt64:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 8, 0,
2c2fa1
-		      "int", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 64, 0, "int");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     case btUInt64:
2c2fa1
-      tp = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
2c2fa1
-		      "unsigned int", objfile);
2c2fa1
+      tp = init_integer_type (objfile, 64, 1, "unsigned int");
2c2fa1
       break;
2c2fa1
 
2c2fa1
     default:
2c2fa1
@@ -1656,7 +1632,7 @@
2c2fa1
       /* Try to cross reference this type, build new type on failure.  */
2c2fa1
       ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
2c2fa1
       if (tp == (struct type *) NULL)
2c2fa1
-	tp = init_type (type_code, 0, 0, (char *) NULL, mdebugread_objfile);
2c2fa1
+	tp = init_type (mdebugread_objfile, type_code, 0, NULL);
2c2fa1
 
2c2fa1
       /* DEC c89 produces cross references to qualified aggregate types,
2c2fa1
          dereference them.  */
2c2fa1
@@ -1715,7 +1691,7 @@
2c2fa1
       /* Try to cross reference this type, build new type on failure.  */
2c2fa1
       ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
2c2fa1
       if (tp == (struct type *) NULL)
2c2fa1
-	tp = init_type (type_code, 0, 0, (char *) NULL, mdebugread_objfile);
2c2fa1
+	tp = init_type (mdebugread_objfile, type_code, 0, NULL);
2c2fa1
 
2c2fa1
       /* Make sure that TYPE_CODE(tp) has an expected type code.
2c2fa1
          Any type may be returned from cross_ref if file indirect entries
2c2fa1
@@ -4433,13 +4409,13 @@
2c2fa1
     }
2c2fa1
 
2c2fa1
   /* mips cc uses a rf of -1 for opaque struct definitions.
2c2fa1
-     Set TYPE_FLAG_STUB for these types so that check_typedef will
2c2fa1
+     Set TYPE_STUB for these types so that check_typedef will
2c2fa1
      resolve them if the struct gets defined in another compilation unit.  */
2c2fa1
   if (rf == -1)
2c2fa1
     {
2c2fa1
       *pname = "<undefined>";
2c2fa1
-      *tpp = init_type (type_code, 0, TYPE_FLAG_STUB,
2c2fa1
-			(char *) NULL, mdebugread_objfile);
2c2fa1
+      *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
2c2fa1
+      TYPE_STUB (*tpp) = 1;
2c2fa1
       return result;
2c2fa1
     }
2c2fa1
 
2c2fa1
@@ -4525,8 +4501,7 @@
2c2fa1
 	  switch (tir.bt)
2c2fa1
 	    {
2c2fa1
 	    case btVoid:
2c2fa1
-	      *tpp = init_type (type_code, 0, 0, (char *) NULL,
2c2fa1
-				mdebugread_objfile);
2c2fa1
+	      *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
2c2fa1
 	      *pname = "<undefined>";
2c2fa1
 	      break;
2c2fa1
 
2c2fa1
@@ -4561,8 +4536,7 @@
2c2fa1
 	      complaint (&symfile_complaints,
2c2fa1
 			 _("illegal bt %d in forward typedef for %s"), tir.bt,
2c2fa1
 			 sym_name);
2c2fa1
-	      *tpp = init_type (type_code, 0, 0, (char *) NULL,
2c2fa1
-				mdebugread_objfile);
2c2fa1
+	      *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
2c2fa1
 	      break;
2c2fa1
 	    }
2c2fa1
 	  return result;
2c2fa1
@@ -4590,7 +4564,7 @@
2c2fa1
 	     has not been parsed yet.
2c2fa1
 	     Initialize the type only, it will be filled in when
2c2fa1
 	     it's definition is parsed.  */
2c2fa1
-	  *tpp = init_type (type_code, 0, 0, (char *) NULL, mdebugread_objfile);
2c2fa1
+	  *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
2c2fa1
 	}
2c2fa1
       add_pending (fh, esh, *tpp);
2c2fa1
     }
2c2fa1
Index: gdb-7.6.1/gdb/stabsread.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/stabsread.c	2017-03-11 21:42:28.099262777 +0100
2c2fa1
+++ gdb-7.6.1/gdb/stabsread.c	2017-03-11 21:45:39.102565532 +0100
2c2fa1
@@ -2098,130 +2098,115 @@
2c2fa1
          is other than 32 bits, then it should use a new negative type
2c2fa1
          number (or avoid negative type numbers for that case).
2c2fa1
          See stabs.texinfo.  */
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 4, 0, "int", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 32, 0, "int");
2c2fa1
       break;
2c2fa1
     case 2:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 1, 0, "char", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 8, 0, "char");
2c2fa1
       break;
2c2fa1
     case 3:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 2, 0, "short", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 16, 0, "short");
2c2fa1
       break;
2c2fa1
     case 4:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 4, 0, "long", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 32, 0, "long");
2c2fa1
       break;
2c2fa1
     case 5:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "unsigned char", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 8, 1, "unsigned char");
2c2fa1
       break;
2c2fa1
     case 6:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 1, 0, "signed char", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 8, 0, "signed char");
2c2fa1
       break;
2c2fa1
     case 7:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "unsigned short", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 16, 1, "unsigned short");
2c2fa1
       break;
2c2fa1
     case 8:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "unsigned int", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 32, 1, "unsigned int");
2c2fa1
       break;
2c2fa1
     case 9:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "unsigned", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 32, 1, "unsigned");
2c2fa1
       break;
2c2fa1
     case 10:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "unsigned long", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 32, 1, "unsigned long");
2c2fa1
       break;
2c2fa1
     case 11:
2c2fa1
-      rettype = init_type (TYPE_CODE_VOID, 1, 0, "void", objfile);
2c2fa1
+      rettype = init_type (objfile, TYPE_CODE_VOID, 1, "void");
2c2fa1
       break;
2c2fa1
     case 12:
2c2fa1
       /* IEEE single precision (32 bit).  */
2c2fa1
-      rettype = init_type (TYPE_CODE_FLT, 4, 0, "float", objfile);
2c2fa1
+      rettype = init_float_type (objfile, 32, "float", NULL);
2c2fa1
       break;
2c2fa1
     case 13:
2c2fa1
       /* IEEE double precision (64 bit).  */
2c2fa1
-      rettype = init_type (TYPE_CODE_FLT, 8, 0, "double", objfile);
2c2fa1
+      rettype = init_float_type (objfile, 64, "double", NULL);
2c2fa1
       break;
2c2fa1
     case 14:
2c2fa1
       /* This is an IEEE double on the RS/6000, and different machines with
2c2fa1
          different sizes for "long double" should use different negative
2c2fa1
          type numbers.  See stabs.texinfo.  */
2c2fa1
-      rettype = init_type (TYPE_CODE_FLT, 8, 0, "long double", objfile);
2c2fa1
+      rettype = init_float_type (objfile, 64, "long double", NULL);
2c2fa1
       break;
2c2fa1
     case 15:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 4, 0, "integer", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 32, 0, "integer");
2c2fa1
       break;
2c2fa1
     case 16:
2c2fa1
-      rettype = init_type (TYPE_CODE_BOOL, 4, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "boolean", objfile);
2c2fa1
+      rettype = init_boolean_type (objfile, 32, 1, "boolean");
2c2fa1
       break;
2c2fa1
     case 17:
2c2fa1
-      rettype = init_type (TYPE_CODE_FLT, 4, 0, "short real", objfile);
2c2fa1
+      rettype = init_float_type (objfile, 32, "short real", NULL);
2c2fa1
       break;
2c2fa1
     case 18:
2c2fa1
-      rettype = init_type (TYPE_CODE_FLT, 8, 0, "real", objfile);
2c2fa1
+      rettype = init_float_type (objfile, 64, "real", NULL);
2c2fa1
       break;
2c2fa1
     case 19:
2c2fa1
-      rettype = init_type (TYPE_CODE_ERROR, 0, 0, "stringptr", objfile);
2c2fa1
+      rettype = init_type (objfile, TYPE_CODE_ERROR, 0, "stringptr");
2c2fa1
       break;
2c2fa1
     case 20:
2c2fa1
-      rettype = init_type (TYPE_CODE_CHAR, 1, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "character", objfile);
2c2fa1
+      rettype = init_character_type (objfile, 8, 1, "character");
2c2fa1
       break;
2c2fa1
     case 21:
2c2fa1
-      rettype = init_type (TYPE_CODE_BOOL, 1, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "logical*1", objfile);
2c2fa1
+      rettype = init_boolean_type (objfile, 8, 1, "logical*1");
2c2fa1
       break;
2c2fa1
     case 22:
2c2fa1
-      rettype = init_type (TYPE_CODE_BOOL, 2, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "logical*2", objfile);
2c2fa1
+      rettype = init_boolean_type (objfile, 16, 1, "logical*2");
2c2fa1
       break;
2c2fa1
     case 23:
2c2fa1
-      rettype = init_type (TYPE_CODE_BOOL, 4, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "logical*4", objfile);
2c2fa1
+      rettype = init_boolean_type (objfile, 32, 1, "logical*4");
2c2fa1
       break;
2c2fa1
     case 24:
2c2fa1
-      rettype = init_type (TYPE_CODE_BOOL, 4, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "logical", objfile);
2c2fa1
+      rettype = init_boolean_type (objfile, 32, 1, "logical");
2c2fa1
       break;
2c2fa1
     case 25:
2c2fa1
       /* Complex type consisting of two IEEE single precision values.  */
2c2fa1
-      rettype = init_type (TYPE_CODE_COMPLEX, 8, 0, "complex", objfile);
2c2fa1
-      TYPE_TARGET_TYPE (rettype) = init_type (TYPE_CODE_FLT, 4, 0, "float",
2c2fa1
-					      objfile);
2c2fa1
+      rettype = init_complex_type (objfile, "complex",
2c2fa1
+				   rs6000_builtin_type (12, objfile));
2c2fa1
       break;
2c2fa1
     case 26:
2c2fa1
       /* Complex type consisting of two IEEE double precision values.  */
2c2fa1
-      rettype = init_type (TYPE_CODE_COMPLEX, 16, 0, "double complex", NULL);
2c2fa1
-      TYPE_TARGET_TYPE (rettype) = init_type (TYPE_CODE_FLT, 8, 0, "double",
2c2fa1
-					      objfile);
2c2fa1
+      rettype = init_complex_type (objfile, "double complex",
2c2fa1
+				   rs6000_builtin_type (13, objfile));
2c2fa1
       break;
2c2fa1
     case 27:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 1, 0, "integer*1", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 8, 0, "integer*1");
2c2fa1
       break;
2c2fa1
     case 28:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 2, 0, "integer*2", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 16, 0, "integer*2");
2c2fa1
       break;
2c2fa1
     case 29:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 4, 0, "integer*4", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 32, 0, "integer*4");
2c2fa1
       break;
2c2fa1
     case 30:
2c2fa1
-      rettype = init_type (TYPE_CODE_CHAR, 2, 0, "wchar", objfile);
2c2fa1
+      rettype = init_character_type (objfile, 16, 0, "wchar");
2c2fa1
       break;
2c2fa1
     case 31:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 8, 0, "long long", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 64, 0, "long long");
2c2fa1
       break;
2c2fa1
     case 32:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "unsigned long long", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 64, 1, "unsigned long long");
2c2fa1
       break;
2c2fa1
     case 33:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 8, TYPE_FLAG_UNSIGNED,
2c2fa1
-			   "logical*8", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 64, 1, "logical*8");
2c2fa1
       break;
2c2fa1
     case 34:
2c2fa1
-      rettype = init_type (TYPE_CODE_INT, 8, 0, "integer*8", objfile);
2c2fa1
+      rettype = init_integer_type (objfile, 64, 0, "integer*8");
2c2fa1
       break;
2c2fa1
     }
2c2fa1
   negative_types[-typenum] = rettype;
2c2fa1
@@ -3757,16 +3742,16 @@
2c2fa1
 {
2c2fa1
   int type_bits;
2c2fa1
   int nbits;
2c2fa1
-  int signed_type;
2c2fa1
-  enum type_code code = TYPE_CODE_INT;
2c2fa1
+  int unsigned_type;
2c2fa1
+  int boolean_type = 0;
2c2fa1
 
2c2fa1
   switch (**pp)
2c2fa1
     {
2c2fa1
     case 's':
2c2fa1
-      signed_type = 1;
2c2fa1
+      unsigned_type = 0;
2c2fa1
       break;
2c2fa1
     case 'u':
2c2fa1
-      signed_type = 0;
2c2fa1
+      unsigned_type = 1;
2c2fa1
       break;
2c2fa1
     default:
2c2fa1
       return error_type (pp, objfile);
2c2fa1
@@ -3783,7 +3768,7 @@
2c2fa1
     (*pp)++;
2c2fa1
   else if (**pp == 'b')
2c2fa1
     {
2c2fa1
-      code = TYPE_CODE_BOOL;
2c2fa1
+      boolean_type = 1;
2c2fa1
       (*pp)++;
2c2fa1
     }
2c2fa1
 
2c2fa1
@@ -3814,14 +3799,17 @@
2c2fa1
     ++(*pp);
2c2fa1
 
2c2fa1
   if (type_bits == 0)
2c2fa1
-    return init_type (TYPE_CODE_VOID, 1,
2c2fa1
-		      signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *) NULL,
2c2fa1
-		      objfile);
2c2fa1
+    {
2c2fa1
+      struct type *type = init_type (objfile, TYPE_CODE_VOID, 1, NULL);
2c2fa1
+      if (unsigned_type)
2c2fa1
+        TYPE_UNSIGNED (type) = 1;
2c2fa1
+      return type;
2c2fa1
+    }
2c2fa1
+
2c2fa1
+  if (boolean_type)
2c2fa1
+    return init_boolean_type (objfile, type_bits, unsigned_type, NULL);
2c2fa1
   else
2c2fa1
-    return init_type (code,
2c2fa1
-		      type_bits / TARGET_CHAR_BIT,
2c2fa1
-		      signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *) NULL,
2c2fa1
-		      objfile);
2c2fa1
+    return init_integer_type (objfile, type_bits, unsigned_type, NULL);
2c2fa1
 }
2c2fa1
 
2c2fa1
 static struct type *
2c2fa1
@@ -3843,16 +3831,16 @@
2c2fa1
   if (nbits != 0)
2c2fa1
     return error_type (pp, objfile);
2c2fa1
 
2c2fa1
+  nbits = nbytes * TARGET_CHAR_BIT;
2c2fa1
+
2c2fa1
   if (details == NF_COMPLEX || details == NF_COMPLEX16
2c2fa1
       || details == NF_COMPLEX32)
2c2fa1
     {
2c2fa1
-      rettype = init_type (TYPE_CODE_COMPLEX, nbytes, 0, NULL, objfile);
2c2fa1
-      TYPE_TARGET_TYPE (rettype)
2c2fa1
-	= init_type (TYPE_CODE_FLT, nbytes / 2, 0, NULL, objfile);
2c2fa1
-      return rettype;
2c2fa1
+      rettype = init_float_type (objfile, nbits / 2, NULL, NULL);
2c2fa1
+      return init_complex_type (objfile, NULL, rettype);
2c2fa1
     }
2c2fa1
 
2c2fa1
-  return init_type (TYPE_CODE_FLT, nbytes, 0, NULL, objfile);
2c2fa1
+  return init_float_type (objfile, nbits, NULL, NULL);
2c2fa1
 }
2c2fa1
 
2c2fa1
 /* Read a number from the string pointed to by *PP.
2c2fa1
@@ -4115,18 +4103,14 @@
2c2fa1
 	}
2c2fa1
 
2c2fa1
       if (got_signed || got_unsigned)
2c2fa1
-	{
2c2fa1
-	  return init_type (TYPE_CODE_INT, nbits / TARGET_CHAR_BIT,
2c2fa1
-			    got_unsigned ? TYPE_FLAG_UNSIGNED : 0, NULL,
2c2fa1
-			    objfile);
2c2fa1
-	}
2c2fa1
+	return init_integer_type (objfile, nbits, got_unsigned, NULL);
2c2fa1
       else
2c2fa1
 	return error_type (pp, objfile);
2c2fa1
     }
2c2fa1
 
2c2fa1
   /* A type defined as a subrange of itself, with bounds both 0, is void.  */
2c2fa1
   if (self_subrange && n2 == 0 && n3 == 0)
2c2fa1
-    return init_type (TYPE_CODE_VOID, 1, 0, NULL, objfile);
2c2fa1
+    return init_type (objfile, TYPE_CODE_VOID, 1, NULL);
2c2fa1
 
2c2fa1
   /* If n3 is zero and n2 is positive, we want a floating type, and n2
2c2fa1
      is the width in bytes.
2c2fa1
@@ -4143,16 +4127,10 @@
2c2fa1
   if (n3 == 0 && n2 > 0)
2c2fa1
     {
2c2fa1
       struct type *float_type
2c2fa1
-	= init_type (TYPE_CODE_FLT, n2, 0, NULL, objfile);
2c2fa1
+	= init_float_type (objfile, n2 * TARGET_CHAR_BIT, NULL, NULL);
2c2fa1
 
2c2fa1
       if (self_subrange)
2c2fa1
-	{
2c2fa1
-	  struct type *complex_type = 
2c2fa1
-	    init_type (TYPE_CODE_COMPLEX, 2 * n2, 0, NULL, objfile);
2c2fa1
-
2c2fa1
-	  TYPE_TARGET_TYPE (complex_type) = float_type;
2c2fa1
-	  return complex_type;
2c2fa1
-	}
2c2fa1
+	return init_complex_type (objfile, NULL, float_type);
2c2fa1
       else
2c2fa1
 	return float_type;
2c2fa1
     }
2c2fa1
@@ -4171,15 +4149,17 @@
2c2fa1
 	  bits = gdbarch_int_bit (gdbarch);
2c2fa1
 	}
2c2fa1
 
2c2fa1
-      return init_type (TYPE_CODE_INT, bits / TARGET_CHAR_BIT,
2c2fa1
-			TYPE_FLAG_UNSIGNED, NULL, objfile);
2c2fa1
+      return init_integer_type (objfile, bits, 1, NULL);
2c2fa1
     }
2c2fa1
 
2c2fa1
   /* Special case: char is defined (Who knows why) as a subrange of
2c2fa1
      itself with range 0-127.  */
2c2fa1
   else if (self_subrange && n2 == 0 && n3 == 127)
2c2fa1
-    return init_type (TYPE_CODE_INT, 1, TYPE_FLAG_NOSIGN, NULL, objfile);
2c2fa1
-
2c2fa1
+    {
2c2fa1
+      struct type *type = init_integer_type (objfile, 1, 0, NULL);
2c2fa1
+      TYPE_NOSIGN (type) = 1;
2c2fa1
+      return type;
2c2fa1
+    }
2c2fa1
   /* We used to do this only for subrange of self or subrange of int.  */
2c2fa1
   else if (n2 == 0)
2c2fa1
     {
2c2fa1
@@ -4189,8 +4169,7 @@
2c2fa1
 
2c2fa1
       if (n3 < 0)
2c2fa1
 	/* n3 actually gives the size.  */
2c2fa1
-	return init_type (TYPE_CODE_INT, -n3, TYPE_FLAG_UNSIGNED,
2c2fa1
-			  NULL, objfile);
2c2fa1
+	return init_integer_type (objfile, -n3 * TARGET_CHAR_BIT, 1, NULL);
2c2fa1
 
2c2fa1
       /* Is n3 == 2**(8n)-1 for some integer n?  Then it's an
2c2fa1
          unsigned n-byte integer.  But do require n to be a power of
2c2fa1
@@ -4204,8 +4183,7 @@
2c2fa1
 	  bits >>= 8;
2c2fa1
 	if (bits == 0
2c2fa1
 	    && ((bytes - 1) & bytes) == 0) /* "bytes is a power of two" */
2c2fa1
-	  return init_type (TYPE_CODE_INT, bytes, TYPE_FLAG_UNSIGNED, NULL,
2c2fa1
-			    objfile);
2c2fa1
+	  return init_integer_type (objfile, bytes * TARGET_CHAR_BIT, 1, NULL);
2c2fa1
       }
2c2fa1
     }
2c2fa1
   /* I think this is for Convex "long long".  Since I don't know whether
2c2fa1
@@ -4215,15 +4193,15 @@
2c2fa1
 	   && (self_subrange
2c2fa1
 	       || n2 == -gdbarch_long_long_bit
2c2fa1
 			  (gdbarch) / TARGET_CHAR_BIT))
2c2fa1
-    return init_type (TYPE_CODE_INT, -n2, 0, NULL, objfile);
2c2fa1
+    return init_integer_type (objfile, -n2 * TARGET_CHAR_BIT, 0, NULL);
2c2fa1
   else if (n2 == -n3 - 1)
2c2fa1
     {
2c2fa1
       if (n3 == 0x7f)
2c2fa1
-	return init_type (TYPE_CODE_INT, 1, 0, NULL, objfile);
2c2fa1
+	return init_integer_type (objfile, 8, 0, NULL);
2c2fa1
       if (n3 == 0x7fff)
2c2fa1
-	return init_type (TYPE_CODE_INT, 2, 0, NULL, objfile);
2c2fa1
+	return init_integer_type (objfile, 16, 0, NULL);
2c2fa1
       if (n3 == 0x7fffffff)
2c2fa1
-	return init_type (TYPE_CODE_INT, 4, 0, NULL, objfile);
2c2fa1
+	return init_integer_type (objfile, 32, 0, NULL);
2c2fa1
     }
2c2fa1
 
2c2fa1
   /* We have a real range type on our hands.  Allocate space and