This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 05/10] vla: allow side effects for sizeof argument
- From: Sanimir Agovic <sanimir dot agovic at intel dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 21 Oct 2013 16:40:19 +0200
- Subject: [PATCH 05/10] vla: allow side effects for sizeof argument
- Authentication-results: sourceware.org; auth=none
- References: <1382366424-21010-1-git-send-email-sanimir dot agovic at intel dot com>
C99 requires the sizeof operator to be evaluated at runtime to compute
the size of the vla, reflect this behavior in gdb.
1| void foo (size_t n, int vla[n][n]) {
2| }
(gdb) p sizeof(vla[0])
yields N.
2013-10-18 Sanimir Agovic <sanimir.agovic@intel.com>
Keven Boell <keven.boell@intel.com>
* eval.c (evaluate_subexp_for_sizeof): Allow side effects for
argument to sizeof.
Change-Id: I945e8a259e850cc0470faa742a0d2191122ef37b
---
gdb/eval.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gdb/eval.c b/gdb/eval.c
index ab3cb95..91cc299 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -3055,7 +3055,7 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos)
value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
default:
- val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
+ val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL);
return value_from_longest (size_type,
(LONGEST) TYPE_LENGTH (value_type (val)));
}
--
1.7.0.7