r210059 - Fix -emit-codegen-only to not generate binaries
Alp Toker
alp at nuanti.com
Tue Jun 3 10:32:44 PDT 2014
On 03/06/2014 14:55, Kostya Serebryany wrote:
> I've disabled part of the test in r210096.
> Please fix the leak and er-enable it back.
Many thanks Kostya, it's awesome to have this detected so fast :-)
Leak fixed and tests re-enabled in r210115.
Alp.
>
> btw, valgrind agrees with lsan about this leak:
> 8,232 (40 direct, 8,192 indirect) bytes in 1 blocks are definitely
> lost in loss record 9 of 9
> at 0x4C2C9EE: operator new(unsigned long) (vg_replace_malloc.c:319)
> by 0x1700459: GetOutputStream(clang::CompilerInstance&,
> llvm::StringRef, clang::BackendAction)
> by 0x1700EEF:
> clang::CodeGenAction::CreateASTConsumer(clang::CompilerInstance&,
> llvm::StringRef)
> by 0x1247C0F:
> clang::FrontendAction::CreateWrappedASTConsumer(clang::CompilerInstance&,
> llvm::StringRef)
> by 0x1248A7A:
> clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&,
> clang::FrontendInputFile const&)
> by 0x122970F:
> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
> by 0x12C5801:
> clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
> by 0x6D4487: cc1_main(char const**, char const**, char const*, void*)
> by 0x6AEBEF: main
>
>
>
> On Tue, Jun 3, 2014 at 3:40 PM, Kostya Serebryany <kcc at google.com
> <mailto:kcc at google.com>> wrote:
>
> Hi Alp,
>
> our sanitizer bot started seeing a leak, which is likely related
> to this change:
> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/3589/steps/check-clang%20asan/logs/stdio
>
>
>
> ==8553==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 40 byte(s) in 1 object(s) allocated from:
> #0 0x706bc1 in operator new(unsigned long) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:62
> #1 0x3665288 in GetOutputStream(clang::CompilerInstance&, llvm::StringRef, clang::BackendAction) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:571
> #2 0x3663775 in clang::CodeGenAction::CreateASTConsumer(clang::CompilerInstance&, llvm::StringRef) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:582
> #3 0x296753d in clang::FrontendAction::CreateWrappedASTConsumer(clang::CompilerInstance&, llvm::StringRef) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:138
> #4 0x2969ed1 in clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&, clang::FrontendInputFile const&) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:310
> #5 0x28e1120 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:721
> #6 0x2ad1ba4 in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:240
> #7 0x7a8bb5 in cc1_main(char const**, char const**, char const*, void*) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/tools/driver/cc1_main.cpp:112
> #8 0x7a3b08 in main /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/tools/driver/driver.cpp:318
> #9 0x7fcce7bcfec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)
>
> Indirect leak of 8192 byte(s) in 1 object(s) allocated from:
> #0 0x706d21 in operator new[](unsigned long) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:64
> #1 0x7b555f in SetBufferSize /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/raw_ostream.h:104
> #2 0x7b555f in llvm::formatted_raw_ostream::releaseStream() /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/FormattedStream.h:161
> #3 0x3670901 in ~formatted_raw_ostream /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/Support/FormattedStream.h:98
> #4 0x3670901 in EmitAssembly /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:596
> #5 0x3670901 in clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:606
> #6 0x36690b2 in clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:174
> #7 0x454fbd2 in clang::ParseAST(clang::Sema&, bool, bool) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Parse/ParseAST.cpp:154
> #8 0x366576f in clang::CodeGenAction::ExecuteAction() /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:676
> #9 0x296bd7a in clang::FrontendAction::Execute() /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:415
> #10 0x28e1131 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:722
> #11 0x2ad1ba4 in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:240
> #12 0x7a8bb5 in cc1_main(char const**, char const**, char const*, void*) /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/tools/driver/cc1_main.cpp:112
> #13 0x7a3b08 in main /home/dtoolsbot/build/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/tools/driver/driver.cpp:318
> #14 0x7fcce7bcfec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)
>
> SUMMARY: AddressSanitizer: 8232 byte(s) leaked in 2 allocation(s).
>
> --
>
> ********************
>
>
>
> On Tue, Jun 3, 2014 at 6:14 AM, Alp Toker <alp at nuanti.com
> <mailto:alp at nuanti.com>> wrote:
>
> Author: alp
> Date: Mon Jun 2 21:14:20 2014
> New Revision: 210059
>
> URL: http://llvm.org/viewvc/llvm-project?rev=210059&view=rev
> Log:
> Fix -emit-codegen-only to not generate binaries
>
> Added:
> cfe/trunk/test/Frontend/disable-output.c
> Modified:
> cfe/trunk/lib/CodeGen/CodeGenAction.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=210059&r1=210058&r2=210059&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Mon Jun 2
> 21:14:20 2014
> @@ -568,6 +568,7 @@ static raw_ostream *GetOutputStream(Comp
> case Backend_EmitNothing:
> return nullptr;
> case Backend_EmitMCNull:
> + return new raw_null_ostream();
> case Backend_EmitObj:
> return CI.createDefaultOutputFile(true, InFile, "o");
> }
>
> Added: cfe/trunk/test/Frontend/disable-output.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/disable-output.c?rev=210059&view=auto
> ==============================================================================
> --- cfe/trunk/test/Frontend/disable-output.c (added)
> +++ cfe/trunk/test/Frontend/disable-output.c Mon Jun 2
> 21:14:20 2014
> @@ -0,0 +1,7 @@
> +// REQUIRES: x86-registered-target
> +// RUN: %clang_cc1 %s -emit-llvm-only
> -triple=i386-apple-darwin -o %t
> +// RUN: not rm %t
> +// RUN: %clang_cc1 %s -emit-codegen-only
> -triple=i386-apple-darwin -o %t
> +// RUN: not rm %t
> +
> +// Test that output is not generated when emission is disabled.
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu <mailto:cfe-commits at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
>
--
http://www.nuanti.com
the browser experts
More information about the cfe-commits
mailing list