diff options
author | Tom Tromey <tom@tromey.com> | 2022-12-23 12:55:10 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-01-09 12:16:02 -0700 |
commit | bf716a53bd8f725975979397b3c6b9d4bd4434ef (patch) | |
tree | 472d2628a581b225e82347da900f37ccc4fdd720 /gdb/eval.c | |
parent | 000f9cbef95caeacdd5a02a9ca9eae7928e1e63e (diff) | |
download | fsf-binutils-gdb-bf716a53bd8f725975979397b3c6b9d4bd4434ef.zip fsf-binutils-gdb-bf716a53bd8f725975979397b3c6b9d4bd4434ef.tar.gz fsf-binutils-gdb-bf716a53bd8f725975979397b3c6b9d4bd4434ef.tar.bz2 |
Fix crash with C++ qualified names
PR c++/29503 points out that something like "b->Base::member" will
crash when 'b' does not have pointer type. This seems to be a simple
oversight in eval_op_member.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29503
Reviewed-By: Bruno Larsen <blarsen@redhat.com>
Diffstat (limited to 'gdb/eval.c')
-rw-r--r-- | gdb/eval.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1309,6 +1309,8 @@ eval_op_member (struct type *expect_type, struct expression *exp, case TYPE_CODE_MEMBERPTR: /* Now, convert these values to an address. */ + if (check_typedef (value_type (arg1))->code () != TYPE_CODE_PTR) + arg1 = value_addr (arg1); arg1 = value_cast_pointers (lookup_pointer_type (TYPE_SELF_TYPE (type)), arg1, 1); |