summaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-13 16:51:51 +0000
committerTom Tromey <tromey@redhat.com>2013-05-13 16:51:51 +0000
commit9ff19ea62ce51ec67ab3fe646aec8a5b3d8b06ce (patch)
tree71368a5656a5b0eca423488c0c78d55c38c3cdc3 /gdb/eval.c
parent599663b891b44af7854305c29b2e5c9036d3d18a (diff)
downloadgdb-9ff19ea62ce51ec67ab3fe646aec8a5b3d8b06ce.tar.gz
PR exp/15364:
* eval.c (evaluate_subexp_standard) <STRUCTOP_STRUCT, STRUCTOP_PTR>: Return a not_lval value for EVAL_AVOID_SIDE_EFFECTS. * opencl-lang.c (evaluate_subexp_opencl): Return a not_lval value for EVAL_AVOID_SIDE_EFFECTS. gdb/testsuite * gdb.base/exprs.exp (test_expr): Add regression test. * gdb.base/exprs.c (null_t_struct): New global.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index f04baeee8e4..cf1fda96b6f 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1847,9 +1847,11 @@ evaluate_subexp_standard (struct type *expect_type,
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- /* Also handle EVAL_AVOID_SIDE_EFFECTS. */
- return value_struct_elt (&arg1, NULL, &exp->elts[pc + 2].string,
+ arg3 = value_struct_elt (&arg1, NULL, &exp->elts[pc + 2].string,
NULL, "structure");
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ arg3 = value_zero (value_type (arg3), not_lval);
+ return arg3;
case STRUCTOP_PTR:
tem = longest_to_int (exp->elts[pc + 1].longconst);
@@ -1899,9 +1901,11 @@ evaluate_subexp_standard (struct type *expect_type,
}
}
- /* Also handle EVAL_AVOID_SIDE_EFFECTS. */
- return value_struct_elt (&arg1, NULL, &exp->elts[pc + 2].string,
+ arg3 = value_struct_elt (&arg1, NULL, &exp->elts[pc + 2].string,
NULL, "structure pointer");
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ arg3 = value_zero (value_type (arg3), not_lval);
+ return arg3;
case STRUCTOP_MEMBER:
case STRUCTOP_MPTR: