This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 05/10] vla: allow side effects for sizeof argument
- From: Tom Tromey <tromey at redhat dot com>
- To: "Agovic\, Sanimir" <sanimir dot agovic at intel dot com>
- Cc: "gdb-patches\ at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 28 Oct 2013 15:00:09 -0600
- Subject: Re: [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> <1382366424-21010-6-git-send-email-sanimir dot agovic at intel dot com> <87d2mua1gi dot fsf at fleche dot redhat dot com> <0377C58828D86C4588AEEC42FC3B85A71769F292 at IRSMSX105 dot ger dot corp dot intel dot com>
>>>>> "Sanimir" == Agovic, Sanimir <sanimir.agovic@intel.com> writes:
Sanimir> I avoid to re-send the complete patch series, thus see my
Sanimir> alternative proposal below. Once I receive more feedback
Sanimir> I will re-publish my patch series including this fix if
Sanimir> applicable.
I don't see how this version of the patch solves what I thought the
problem was.
I'm sure it is just my misunderstanding though.
Sanimir> Meanwhile you can track our latest development efforts on
Sanimir> http://intel-gdb.github.io/ branch vla-c99.
Is that all rebased to binutils-gdb.git now?
If so I will start fetching from it again.
Sanimir> + case BINOP_SUBSCRIPT:
Sanimir> + /* In case of a variable length array we need to evaluate the subscript
Sanimir> + with side effects to correcly infere the size. */
Sanimir> + val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL);
Sanimir> + return value_from_longest (size_type,
Sanimir> + (LONGEST) TYPE_LENGTH (value_type (val)));
This makes it seem like the problem case is "sizeof (vla[index])".
But I would have thought it was "sizeof (vla)".
In any case I think this patch still has the issue, just at one remove.
Like:
(gdb) print sizeof (array[x++])
For an ordinary array this should not modify x.
Tom