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: Wed, 20 Nov 2013 12:16:42 +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> <0377C58828D86C4588AEEC42FC3B85A7176B5F16 at IRSMSX105 dot ger dot corp dot intel dot com> <87vbzppuz5 dot fsf at fleche dot redhat dot com>
> -----Original Message-----
> From: Tom Tromey [mailto:tromey@redhat.com]
> Sent: Monday, November 18, 2013 04:53 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> It turns out this patch is not needed anymore as the bounds are
> Sanimir> resolved before the sizeof function is called. So in v2 this
> Sanimir> patch will be dropped from the series.
>
> Tom> (gdb) print sizeof (array[x++])
> Tom> For an ordinary array this should not modify x.
>
> Sanimir> Indeed, that is the behavior we have now in HEAD@vla-c99.
>
> I thought sizeof with a vla as an argument had to evaluate its argument.
> So it seems that the above may yield incorrect semantics in some other
> test case.
>
The patch was needed for a now discontinued vla prototype, meanwhile we
moved the logic to the following value constructors
value_at/value_at_lazy/value_from_contents_and_address which is easier to
maintain and is mostly transparent to existing code.
In this particular case we will end up in dispatching 'array' in the switch
case 'OP_VAR_VALUE', using value_of_variable which will end up calling a
value constructor with an address, therefore we resolved correctly the
bounds and the patch is not needed anymore.
-Sanimir
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