mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 00:32:30 +08:00
* valops.c (value_cast): Simplify and correct logic for doing a
static cast from a pointer to a base class to a pointer to a derived class.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2002-08-21 Jim Blandy <jimb@redhat.com>
|
||||||
|
|
||||||
|
* valops.c (value_cast): Simplify and correct logic for doing a
|
||||||
|
static cast from a pointer to a base class to a pointer to a
|
||||||
|
derived class.
|
||||||
|
|
||||||
2002-08-21 Andrew Cagney <ac131313@redhat.com>
|
2002-08-21 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
* infcmd.c (default_print_registers_info): Replace
|
* infcmd.c (default_print_registers_info): Replace
|
||||||
|
17
gdb/valops.c
17
gdb/valops.c
@ -361,18 +361,11 @@ value_cast (struct type *type, struct value *arg2)
|
|||||||
value_zero (t1, not_lval), 0, t1, 1);
|
value_zero (t1, not_lval), 0, t1, 1);
|
||||||
if (v)
|
if (v)
|
||||||
{
|
{
|
||||||
struct value *v2 = value_ind (arg2);
|
CORE_ADDR addr2 = value_as_address (arg2);
|
||||||
VALUE_ADDRESS (v2) -= VALUE_ADDRESS (v)
|
addr2 -= (VALUE_ADDRESS (v)
|
||||||
+ VALUE_OFFSET (v);
|
+ VALUE_OFFSET (v)
|
||||||
|
+ VALUE_EMBEDDED_OFFSET (v));
|
||||||
/* JYG: adjust the new pointer value and
|
return value_from_pointer (type, addr2);
|
||||||
embedded offset. */
|
|
||||||
v2->aligner.contents[0] -= VALUE_EMBEDDED_OFFSET (v);
|
|
||||||
VALUE_EMBEDDED_OFFSET (v2) = 0;
|
|
||||||
|
|
||||||
v2 = value_addr (v2);
|
|
||||||
VALUE_TYPE (v2) = type;
|
|
||||||
return v2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user