decl.c (init_decl_processing): Use set_sizetype.
authorJ"orn Rennecke <amylaar@cygnus.co.uk>
Sun, 1 Feb 1998 11:45:10 +0000 (11:45 +0000)
committerJeff Law <law@gcc.gnu.org>
Sun, 1 Feb 1998 11:45:10 +0000 (04:45 -0700)
        * decl.c (init_decl_processing): Use set_sizetype.
        * decl2.c (sizetype): Don't declare.
        * typeck.c (c_sizeof): Convert result of *_DIV_EXPR to sizetype.
        (c_sizeof_nowarn, build_binary_op_nodefault): Likewise.
        (build_component_addr, unary_complex_lvalue): Likewise.
        * rtti.c (expand_class_desc): Likewise.
        * class.c (get_vfield_offset): Likewise.

From-SVN: r17576

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/parse.c
gcc/cp/rtti.c
gcc/cp/typeck.c

index 67391f8b9569dcd41724da322bc3ad7e4ce85a8f..4bd271f71342dc8ca3cb88e5e36f661623d1c1a0 100644 (file)
@@ -1,3 +1,13 @@
+Sun Feb  1 12:45:34 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+       * decl.c (init_decl_processing): Use set_sizetype.
+       * decl2.c (sizetype): Don't declare.
+       * typeck.c (c_sizeof): Convert result of *_DIV_EXPR to sizetype.
+       (c_sizeof_nowarn, build_binary_op_nodefault): Likewise.
+       (build_component_addr, unary_complex_lvalue): Likewise.
+       * rtti.c (expand_class_desc): Likewise.
+       * class.c (get_vfield_offset): Likewise.
+
 Thu Jan 29 10:39:30 1998  Mark Mitchell  <mmitchell@usa.net>
 
        * pt.c (convert_nontype_argument): Move check for is_overloaded_fn
index 0e042ee2b5861f403b9559c5351b16c4366c406a..c1afde4d9cc608a780f4a3941744d4f3aec1ecb7 100644 (file)
@@ -606,11 +606,12 @@ tree
 get_vfield_offset (binfo)
      tree binfo;
 {
-  return size_binop (PLUS_EXPR,
-                    size_binop (FLOOR_DIV_EXPR,
-                                DECL_FIELD_BITPOS (CLASSTYPE_VFIELD (BINFO_TYPE (binfo))),
-                                size_int (BITS_PER_UNIT)),
-                    BINFO_OFFSET (binfo));
+  tree tmp
+    = size_binop (FLOOR_DIV_EXPR,
+                 DECL_FIELD_BITPOS (CLASSTYPE_VFIELD (BINFO_TYPE (binfo))),
+                 size_int (BITS_PER_UNIT));
+  tmp = convert (sizetype, tmp);
+  return size_binop (PLUS_EXPR, tmp, BINFO_OFFSET (binfo));
 }
 
 /* Get the offset to the start of the original binfo that we derived
index fdac895ef2d851cccaa14ec752e9364b565a8b07..c939b42d965dd7161877d4cff97e35e31beb28fc 100644 (file)
@@ -4998,23 +4998,13 @@ init_decl_processing ()
 
   /* `unsigned long' is the standard type for sizeof.
      Note that stddef.h uses `unsigned long',
-     and this must agree, even of long and int are the same size.  */
-  sizetype
-    = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE)));
+     and this must agree, even if long and int are the same size.  */
+  set_sizetype
+    (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE))));
 
   ptrdiff_type_node
     = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE)));
 
-  TREE_TYPE (TYPE_SIZE (integer_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (char_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (unsigned_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (long_unsigned_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (long_integer_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (long_long_integer_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (long_long_unsigned_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (short_integer_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (short_unsigned_type_node)) = sizetype;
-
   /* Define both `signed char' and `unsigned char'.  */
   signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE);
   record_builtin_type (RID_MAX, "signed char", signed_char_type_node);
index beae07ad047299fdffb5bee4b0a7bdd8c535684e..4290f71b696cb364ada684d4300cf38c4f0451e3 100644 (file)
@@ -2370,8 +2370,6 @@ finish_builtin_type (type, name, fields, len, align_type)
    `operator new' and `operator delete' correspond to
    what compiler will be expecting.  */
 
-extern tree sizetype;
-
 tree
 coerce_new_type (type)
      tree type;
index d9b4f301baa4fcfdab3d91e24dec814c107be4e8..5f2e32965c355ae0c41527079bb1fff9ff956c1a 100644 (file)
@@ -3502,7 +3502,7 @@ static const short yycheck[] = {     4,
     76,    77,    78,    79,    80,    81,    82,    83,    84,    85
 };
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
-#line 3 "/usr/lib/bison.simple"
+#line 3 "/usr/share/bison.simple"
 
 /* Skeleton output parser for bison,
    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -3695,7 +3695,7 @@ __yy_memcpy (char *to, char *from, int count)
 #endif
 #endif
 \f
-#line 196 "/usr/lib/bison.simple"
+#line 196 "/usr/share/bison.simple"
 
 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
    into yyparse.  The argument should have type void *.
@@ -8456,7 +8456,7 @@ case 842:
     break;}
 }
    /* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/lib/bison.simple"
+#line 498 "/usr/share/bison.simple"
 \f
   yyvsp -= yylen;
   yyssp -= yylen;
index 18d45ba69cb62cf2b906064e407e12c1b263fb44..b4e79593e65c39fab1756f40ff046a9dac4885ea 100644 (file)
@@ -785,6 +785,7 @@ expand_class_desc (tdecl, type)
          field = lookup_field (type, get_identifier (name), 0, 0);
          offset = size_binop (FLOOR_DIV_EXPR, 
                DECL_FIELD_BITPOS (field), size_int (BITS_PER_UNIT));
+         offset = convert (sizetype, offset);
        }
       else
        offset = BINFO_OFFSET (binfo);
index 5009644eabbf4e72956c3689eee91952b6acc06b..76302a8c634ae91f2bbe61629b03c6c21a12fc6f 100644 (file)
@@ -1403,6 +1403,7 @@ c_sizeof (type)
   /* 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;
@@ -1460,6 +1461,7 @@ c_sizeof_nowarn (type)
   /* 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;
 }
@@ -3537,6 +3539,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
              delta21 = CLASSTYPE_VFIELD (TYPE_METHOD_BASETYPE (TREE_TYPE (type1)));
              delta21 = DECL_FIELD_BITPOS (delta21);
              delta21 = size_binop (FLOOR_DIV_EXPR, delta21, size_int (BITS_PER_UNIT));
+             delta21 = convert (sizetype, delta21);
            }
          else
            index1 = integer_neg_one_node;
@@ -4092,6 +4095,7 @@ build_component_addr (arg, argtype, msg)
       tree offset = size_binop (EASY_DIV_EXPR, DECL_FIELD_BITPOS (field),
                                size_int (BITS_PER_UNIT));
       int flag = TREE_CONSTANT (rval);
+      offset = convert (sizetype, offset);
       rval = fold (build (PLUS_EXPR, argtype,
                          rval, cp_convert (argtype, offset)));
       TREE_CONSTANT (rval) = flag;
@@ -4746,9 +4750,10 @@ unary_complex_lvalue (code, arg)
 
          /* Add in the offset to the field.  */
          offset = size_binop (PLUS_EXPR, offset,
-                              size_binop (EASY_DIV_EXPR,
-                                          DECL_FIELD_BITPOS (t),
-                                          size_int (BITS_PER_UNIT)));
+                              convert (sizetype,
+                                       size_binop (EASY_DIV_EXPR,
+                                                   DECL_FIELD_BITPOS (t),
+                                                   size_int (BITS_PER_UNIT))));
 
          /* We offset all pointer to data members by 1 so that we can
             distinguish between a null pointer to data member and the first