On 12/2/11 3:24 PM, Eli Friedman wrote:> On Fri, Dec 2, 2011 at 1:04 PM, John Criswell<criswell at illinois.edu> wrote: >> Dear All, >> >> Is there an optimization in the x86 back-end that could cause two >> alloca's to use overlapping memory? > It's theoretically possible, but IIRC there isn't any such > optimization implemented at the moment.Could the tail call optimization cause something like this? If there's an alloca in a function and the function is called recursively, could tail call optimization cause all dynamic instances of the alloca to be allocated in the same place on the stack? -- John T.> > -Eli
On Fri, Dec 2, 2011 at 2:23 PM, John Criswell <criswell at illinois.edu> wrote:> On 12/2/11 3:24 PM, Eli Friedman wrote: >> >> On Fri, Dec 2, 2011 at 1:04 PM, John Criswell<criswell at illinois.edu> >> wrote: >>> >>> Dear All, >>> >>> Is there an optimization in the x86 back-end that could cause two >>> alloca's to use overlapping memory? >> >> It's theoretically possible, but IIRC there isn't any such >> optimization implemented at the moment. > > > Could the tail call optimization cause something like this? If there's an > alloca in a function and the function is called recursively, could tail call > optimization cause all dynamic instances of the alloca to be allocated in > the same place on the stack?Yes, that's possible (although I would expect it to be rare). -Eli
On 12/2/11 4:27 PM, Eli Friedman wrote:> On Fri, Dec 2, 2011 at 2:23 PM, John Criswell<criswell at illinois.edu> wrote: >> On 12/2/11 3:24 PM, Eli Friedman wrote: >>> On Fri, Dec 2, 2011 at 1:04 PM, John Criswell<criswell at illinois.edu> >>> wrote: >>>> Dear All, >>>> >>>> Is there an optimization in the x86 back-end that could cause two >>>> alloca's to use overlapping memory? >>> It's theoretically possible, but IIRC there isn't any such >>> optimization implemented at the moment. >> >> Could the tail call optimization cause something like this? If there's an >> alloca in a function and the function is called recursively, could tail call >> optimization cause all dynamic instances of the alloca to be allocated in >> the same place on the stack? > Yes, that's possible (although I would expect it to be rare).Thanks. Is there any way to turn tail call optimization off from the clang command line? -- John T.> > -Eli