summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/class.c11
-rw-r--r--gcc/cp/decl.c16
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/cp/parse.c6
-rw-r--r--gcc/cp/rtti.c1
-rw-r--r--gcc/cp/typeck.c11
7 files changed, 31 insertions, 26 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 67391f8b956..4bd271f7134 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 0e042ee2b58..c1afde4d9cc 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -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
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index fdac895ef2d..c939b42d965 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index beae07ad047..4290f71b696 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -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;
diff --git a/gcc/cp/parse.c b/gcc/cp/parse.c
index d9b4f301baa..5f2e32965c3 100644
--- a/gcc/cp/parse.c
+++ b/gcc/cp/parse.c
@@ -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
-#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"
yyvsp -= yylen;
yyssp -= yylen;
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 18d45ba69cb..b4e79593e65 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -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);
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 5009644eabb..76302a8c634 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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