diff options
author | Joern Rennecke <amylaar@redhat.com> | 2001-08-30 12:44:22 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2001-08-30 08:44:22 -0400 |
commit | f232e4a5007e4367b4985d275d2a28dc2e44c8a6 (patch) | |
tree | 6bce5482fdc3608ec966a1e66aac8846c19c3dd0 /gcc | |
parent | c8cbefbb579cf30d50110e3ce7ba4cf796282994 (diff) | |
download | gcc-f232e4a5007e4367b4985d275d2a28dc2e44c8a6.zip gcc-f232e4a5007e4367b4985d275d2a28dc2e44c8a6.tar.gz gcc-f232e4a5007e4367b4985d275d2a28dc2e44c8a6.tar.bz2 |
class.c (build_vtable_entry_ref): Subtract in char*, not ptrdiff_t.
* class.c (build_vtable_entry_ref): Subtract in char*, not
ptrdiff_t.
Co-Authored-By: Jason Merrill <jason@redhat.com>
From-SVN: r45284
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/class.c | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4a4f80d..5acd064 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-08-30 Joern Rennecke <amylaar@redhat.com> + Jason Merrill <jason_merrill@redhat.com> + + * class.c (build_vtable_entry_ref): Subtract in char*, not + ptrdiff_t. + 2001-08-23 Jason Merrill <jason_merrill@redhat.com> * tree.c (cp_build_qualified_type_real): Use get_qualified_type. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 8f60f23..3a9e389 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -444,9 +444,12 @@ build_vtable_entry_ref (basetype, idx) s = build_tree_list (build_string (1, "s"), s); i = build_array_ref (first_fn, idx); - i = build_c_cast (ptrdiff_type_node, build_unary_op (ADDR_EXPR, i, 0)); + /* We must not convert to ptrdiff_type node here, since this could widen + from a partial to an integral node, which would create a + convert_expression that would be in the way of any simplifications. */ + i = build_c_cast (string_type_node, build_unary_op (ADDR_EXPR, i, 0)); i2 = build_array_ref (vtable, build_int_2 (0,0)); - i2 = build_c_cast (ptrdiff_type_node, build_unary_op (ADDR_EXPR, i2, 0)); + i2 = build_c_cast (string_type_node, build_unary_op (ADDR_EXPR, i2, 0)); i = cp_build_binary_op (MINUS_EXPR, i, i2); i = build_tree_list (build_string (1, "i"), i); |