[PATCH] fix a small leak in MC/MCAsmStreamer.cpp

Kostya Serebryany kcc at google.com
Thu Apr 24 08:07:25 PDT 2014


And yes, your patch fixes the leaks. :)




On Thu, Apr 24, 2014 at 7:03 PM, Kostya Serebryany <kcc at google.com> wrote:

>
>
>
> On Thu, Apr 24, 2014 at 6:55 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> On Thu, Apr 24, 2014 at 7:48 AM, Kostya Serebryany <kcc at google.com>
>> wrote:
>> > Hmm...
>> > Now I am getting
>> > opt: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.18'
>> not
>> > found
>> >
>> > Could your CL be the reason?
>>
>> /maybe/... but I'd be surprised if my cl was the culprit there.
>
> It is:
>
> % svn up -r 207117
> % ninja llvm-mc && bin/llvm-mc < /dev/null
> [3/3] Linking CXX executable bin/llvm-mc
>         .text
>
> % svn up -r 207118
> % ninja llvm-mc && bin/llvm-mc < /dev/null
> [3/3] Linking CXX executable bin/llvm-mc
> bin/llvm-mc: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version
> `GLIBCXX_3.4.18' not found (required by bin/llvm-mc)
>
>
>
>
>> I
>> think this has shown up when you've got a locally installed newer-gcc
>> than your system GCC, and you built a binary with that (or with a
>> clang that found libstdc++ from that install) and you don't have an
>> updated LD_LIBRARY_PATH to point to the shared libraries to match/find
>> them during execution.
>>
>
> Correct, LD_LIBRARY_PATH=/usr/local/gcc-4.8.2/lib64/ helps in my case.
> But before your patch this was not required :(
>
> Our bots on Ubuntu 12.04 are down :(
> Well, I guess we need to fix them...
>
> --kcc
>
>
>>
>> - David
>>
>> >
>> >
>> > On Thu, Apr 24, 2014 at 6:41 PM, David Blaikie <dblaikie at gmail.com>
>> wrote:
>> >>
>> >> Thanks for tracking down the bug, Kostya - I've applied a different
>> >> fix for this in r207118. Do let me know if this still shows up/is
>> >> insufficient/problematic in any way.
>> >>
>> >> (Yay value semantics! \o/)
>> >>
>> >> On Thu, Apr 24, 2014 at 6:43 AM, Kostya Serebryany <kcc at google.com>
>> wrote:
>> >> > Hi,
>> >> > Here is a small patch that fixes (mostly innocent) leak in
>> >> > lib/MC/MCAsmStreamer.cpp,
>> >> > please review.
>> >> > See also http://llvm.org/bugs/show_bug.cgi?id=19521
>> >> >
>> >> > Index: lib/MC/MCAsmStreamer.cpp
>> >> > ===================================================================
>> >> > --- lib/MC/MCAsmStreamer.cpp    (revision 207084)
>> >> > +++ lib/MC/MCAsmStreamer.cpp    (working copy)
>> >> > @@ -9,6 +9,7 @@
>> >> >
>> >> >  #include "llvm/MC/MCStreamer.h"
>> >> >  #include "llvm/ADT/SmallString.h"
>> >> > +#include "llvm/ADT/STLExtras.h"
>> >> >  #include "llvm/ADT/StringExtras.h"
>> >> >  #include "llvm/ADT/Twine.h"
>> >> >  #include "llvm/MC/MCAsmBackend.h"
>> >> > @@ -76,7 +77,9 @@
>> >> >      if (InstPrinter && IsVerboseAsm)
>> >> >        InstPrinter->setCommentStream(CommentStream);
>> >> >    }
>> >> > -  ~MCAsmStreamer() {}
>> >> > +  ~MCAsmStreamer() {
>> >> > +    DeleteContainerSeconds(SymbolMap);
>> >> > +  }
>> >> >
>> >> >    inline void EmitEOL() {
>> >> >      // If we don't have any comments, just emit a \n.
>> >> >
>> >> >
>> >> > =================================
>> >> > Leak report:
>> >> > Direct leak of 80 byte(s) in 1 object(s) allocated from:
>> >> >     #0 0x65d4b0 in operator new(unsigned long)
>> >> > llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:62
>> >> >     #1 0x20d9f9e in (anonymous
>> >> > namespace)::MCAsmStreamer::getOrCreateSymbolData(llvm::MCSymbol
>> const*)
>> >> > llvm/lib/MC/MCAsmStreamer.cpp:1476
>> >> >     #2 0xd4a029 in (anonymous
>> >> > namespace)::ARMAsmParser::onLabelParsed(llvm::MCSymbol*)
>> >> > llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp:8328
>> >> >     #3 0x2924e87 in (anonymous
>> >> > namespace)::AsmParser::parseStatement((anonymous
>> >> > namespace)::ParseStatementInfo&)
>> llvm/lib/MC/MCParser/AsmParser.cpp:1306
>> >> >     #4 0x29123a1 in (anonymous namespace)::AsmParser::Run(bool, bool)
>> >> > llvm/lib/MC/MCParser/AsmParser.cpp:651
>> >> >     #5 0x18bc27f in llvm::AsmPrinter::EmitInlineAsm(llvm::StringRef,
>> >> > llvm::MDNode const*, llvm::InlineAsm::AsmDialect) const
>> >> > llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:151
>> >> >     #6 0x18bfc1e in
>> llvm::AsmPrinter::EmitInlineAsm(llvm::MachineInstr
>> >> > const*) const llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:487
>> >> >     #7 0x189aa80 in llvm::AsmPrinter::EmitFunctionBody()
>> >> > llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:781
>> >> >     #8 0xa0d144 in runOnMachineFunction
>> >> > llvm/include/llvm/CodeGen/AsmPrinter.h:193
>> >> >     #9 0xa0d144 in
>> >> > llvm::ARMAsmPrinter::runOnMachineFunction(llvm::MachineFunction&)
>> >> > llvm/lib/Target/ARM/ARMAsmPrinter.cpp:100
>> >> >     #10 0x1b0566b in
>> >> > llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
>> >> > llvm/lib/CodeGen/MachineFunctionPass.cpp:33
>> >> >     #11 0x2025905 in
>> llvm::FPPassManager::runOnFunction(llvm::Function&)
>> >> > llvm/lib/IR/LegacyPassManager.cpp:1540
>> >> >     #12 0x2025dd5 in llvm::FPPassManager::runOnModule(llvm::Module&)
>> >> > llvm/lib/IR/LegacyPassManager.cpp:1560
>> >> >     #13 0x2026aac in runOnModule
>> llvm/lib/IR/LegacyPassManager.cpp:1618
>> >> >     #14 0x2026aac in
>> llvm::legacy::PassManagerImpl::run(llvm::Module&)
>> >> > llvm/lib/IR/LegacyPassManager.cpp:1725
>> >> >     #15 0x683cf7 in compileModule llvm/tools/llc/llc.cpp:355
>> >> >     #16 0x683cf7 in main llvm/tools/llc/llc.cpp:201
>> >> >
>> >
>> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140424/89e7ed96/attachment.html>


More information about the llvm-commits mailing list