summaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-02-17 19:55:50 -0500
committerTom Tromey <tom@tromey.com>2023-02-21 12:36:15 -0700
commit3592bebbbf6b27732effc49bd6a73b0bd5af4df4 (patch)
tree525112bd0dfe65cad67cebc728186110e1e84f41 /gdb/valarith.c
parent4c9066e322f46faf9d753be6ff3e6a09ae668f86 (diff)
downloadbinutils-gdb-3592bebbbf6b27732effc49bd6a73b0bd5af4df4.tar.gz
Issue error on erroneous expression
A while back I discovered that this does not issue an error: (gdb) p $x = (void * ) 57 $3 = (void *) 0x39 (gdb) p $x + 7 = 3 $6 = (void *) 0x3 This patch fixes the bug. Regression tested on x86-64 Fedora 36. Reviewed-By: Bruno Larsen <blarsen@redhat.com> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19312
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 0ab684aa05b..a6a5f5102a2 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -93,7 +93,7 @@ value_ptradd (struct value *arg1, LONGEST arg2)
result = value_from_pointer (valptrtype,
value_as_address (arg1) + sz * arg2);
- if (result->lval () != lval_internalvar)
+ if (arg1->lval () != lval_internalvar)
result->set_component_location (arg1);
return result;
}