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: "Agovic, Sanimir" <sanimir dot agovic at intel dot com>
- To: 'Tom Tromey' <tromey at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 18 Nov 2013 08:39:00 +0000
- 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> <87ppqp9kme dot fsf at fleche dot redhat dot com>
Thanks for your review.
It turns out this patch is not needed anymore as the bounds are resolved
before the sizeof function is called. So in v2 this patch will be dropped
from the series.
> (gdb) print sizeof (array[x++])
>
> For an ordinary array this should not modify x.
Indeed, that is the behavior we have now in HEAD@vla-c99.
> 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.
Meanwhile the above repository got re-setup to mirror binutils-gdb.git.
-Sanimir
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf
> Of Tom Tromey
> Sent: Monday, October 28, 2013 10:00 PM
> To: Agovic, Sanimir
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH 05/10] vla: allow side effects for sizeof argument
>
> >>>>> "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
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052