This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH 05/10] vla: allow side effects for sizeof argument


> -----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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]