This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 03/10] vla: enable sizeof operator to work with variable length arrays
- From: Tom Tromey <tromey at redhat dot com>
- To: Sanimir Agovic <sanimir dot agovic at intel dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 07 Nov 2013 12:03:05 -0700
- Subject: Re: [PATCH 03/10] vla: enable sizeof operator to work with variable length arrays
- Authentication-results: sourceware.org; auth=none
- References: <1382366424-21010-1-git-send-email-sanimir dot agovic at intel dot com> <1382366424-21010-4-git-send-email-sanimir dot agovic at intel dot com>
>>>>> "Sanimir" == Sanimir Agovic <sanimir.agovic@intel.com> writes:
Sanimir> In C99 the sizeof operator computes the size of a variable
Sanimir> length array at runtime (6.5.3.4 The sizeof operator). This
Sanimir> patch reflects the semantic change in the debugger.
Sanimir> We now are able to get the size of a vla:
Sanimir> 1| void foo (size_t n) {
Sanimir> 2| int vla[n];
Sanimir> 3| }
Sanimir> (gdb) p sizeof(vla)
Sanimir> yields N.
It should yield N * sizeof(int), but I imagine that was just a minor
oversight in your email, as the patch looks correct to me.
Tom