Rafael Espíndola
2006-Nov-30 19:07 UTC
[LLVMdev] [patch] [llvm-gcc4] fix bootstrap failure
On 11/30/06, Andrew Lenharth <andrewl at lenharth.org> wrote:> The llvm_ostreams, which you take the address of go out of scope very > quickly, and are only stored by address in the bytecode writer, thus > the writers have a pointer to a stack allocated object they are to > write to. This crashes.The attached version leaks :-) It is a work around. If I understand correctly, the ostream wrapper is also a temporary solution, so this might be acceptable.> AndrewThanks, Rafael -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-gcc.patch Type: text/x-patch Size: 1255 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20061130/aa0d2158/attachment.bin>
On 11/30/06, Rafael Espíndola <rafael.espindola at gmail.com> wrote:> On 11/30/06, Andrew Lenharth <andrewl at lenharth.org> wrote: > > The llvm_ostreams, which you take the address of go out of scope very > > quickly, and are only stored by address in the bytecode writer, thus > > the writers have a pointer to a stack allocated object they are to > > write to. This crashes. > > The attached version leaks :-) > It is a work around. If I understand correctly, the ostream wrapper is > also a temporary solution, so this might be acceptable.Hmm, that looks like what I did in my tree :) Andrew
On 11/30/06, Rafael Espíndola <rafael.espindola at gmail.com> wrote:> On 11/30/06, Andrew Lenharth <andrewl at lenharth.org> wrote: > > The llvm_ostreams, which you take the address of go out of scope very > > quickly, and are only stored by address in the bytecode writer, thus > > the writers have a pointer to a stack allocated object they are to > > write to. This crashes. > > The attached version leaks :-) > It is a work around. If I understand correctly, the ostream wrapper is > also a temporary solution, so this might be acceptable. >Hey guys, Notice that the llvm_ostream doesn't delete the ostream that you pass into it. If you want to make sure that it's deleted, I think you'll want to pass in "true" to the WriteBytecodePass so that it'll delete the llvm_ostream. This won't affect the AsmOutFile, which gets deleted at the end of the function... -bw
Actually, take a look at the current TOT for llvm-gcc4. Jim & I put a patch in there yesterday that should make things work with llvm_ostreams. -bw On 11/30/06, Bill Wendling <isanbard at gmail.com> wrote:> On 11/30/06, Rafael Espíndola <rafael.espindola at gmail.com> wrote: > > On 11/30/06, Andrew Lenharth <andrewl at lenharth.org> wrote: > > > The llvm_ostreams, which you take the address of go out of scope very > > > quickly, and are only stored by address in the bytecode writer, thus > > > the writers have a pointer to a stack allocated object they are to > > > write to. This crashes. > > > > The attached version leaks :-) > > It is a work around. If I understand correctly, the ostream wrapper is > > also a temporary solution, so this might be acceptable. > > > > Hey guys, > > Notice that the llvm_ostream doesn't delete the ostream that you pass > into it. If you want to make sure that it's deleted, I think you'll > want to pass in "true" to the WriteBytecodePass so that it'll delete > the llvm_ostream. This won't affect the AsmOutFile, which gets deleted > at the end of the function... > > -bw >