Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-11370] Memory leak detected in 'test/SILGen/global_resilience.swift' #53771

Open
rintaro mannequin opened this issue Aug 24, 2019 · 1 comment
Open

[SR-11370] Memory leak detected in 'test/SILGen/global_resilience.swift' #53771

rintaro mannequin opened this issue Aug 24, 2019 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself memory leak bug: Memory leak

Comments

@rintaro
Copy link
Mannequin

rintaro mannequin commented Aug 24, 2019

Previous ID SR-11370
Radar None
Original Reporter @rintaro
Type Bug
Environment

Ubuntu 18.04
master (075dd74)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Leak
Assignee None
Priority Medium

md5: cfecf36aba7d5f1de5465e7475a9060e

Issue Description:

$ utils/build-script -R --debug-swift-stdlib --enable-lsan --skip-build-benchmarks
$ ../build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift -version
Swift version 5.1-dev (LLVM c5340df2d1, Swift 310c9c9d19)
Target: x86_64-unknown-linux-gnu
$ utils/run-test --build-dir ../build/Ninja-ReleaseAssert+stdlib-DebugAssert test/SILGen/global_resilience.swift

... <snip> ...

FAIL: Swift(linux-x86_64) :: SILGen/global_resilience.swift (1 of 1)
******************** TEST 'Swift(linux-x86_64) :: SILGen/global_resilience.swift' FAILED ********************
Script:
--
: 'RUN: at line 1';   rm -rf "/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/test-linux-x86_64/SILGen/Output/global_resilience.swift.tmp" && mkdir -p "/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/test-linux-x86_64/SILGen/Output/global_resilience.swift.tmp"
: 'RUN: at line 2';   /home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift -frontend -target x86_64-unknown-linux-gnu  -module-cache-path '/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 4   -typo-correction-limit 10  -emit-module -enable-library-evolution -emit-module-path=/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/test-linux-x86_64/SILGen/Output/global_resilience.swift.tmp/resilient_global.swiftmodule -module-name=resilient_global /home/rintaro/Repositories/swift-oss/swift/test/SILGen/../Inputs/resilient_global.swift
: 'RUN: at line 3';   /home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift -frontend -target x86_64-unknown-linux-gnu  -module-cache-path '/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 4   -typo-correction-limit 10  -emit-silgen -verify-syntax-tree -I /home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/test-linux-x86_64/SILGen/Output/global_resilience.swift.tmp -enable-library-evolution -parse-as-library /home/rintaro/Repositories/swift-oss/swift/test/SILGen/global_resilience.swift | '/usr/bin/python' '/home/rintaro/Repositories/swift-oss/swift/utils/PathSanitizingFileCheck' --sanitize BUILD_DIR='/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64' --sanitize SOURCE_DIR='/home/rintaro/Repositories/swift-oss/swift' --use-filecheck '/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/llvm-linux-x86_64/bin/FileCheck'  /home/rintaro/Repositories/swift-oss/swift/test/SILGen/global_resilience.swift
: 'RUN: at line 4';   /home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift -frontend -target x86_64-unknown-linux-gnu  -module-cache-path '/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 4   -typo-correction-limit 10  -emit-sil -verify-syntax-tree -I /home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/test-linux-x86_64/SILGen/Output/global_resilience.swift.tmp -O -enable-library-evolution -parse-as-library /home/rintaro/Repositories/swift-oss/swift/test/SILGen/global_resilience.swift | '/usr/bin/python' '/home/rintaro/Repositories/swift-oss/swift/utils/PathSanitizingFileCheck' --sanitize BUILD_DIR='/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64' --sanitize SOURCE_DIR='/home/rintaro/Repositories/swift-oss/swift' --use-filecheck '/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/llvm-linux-x86_64/bin/FileCheck'  --check-prefix=CHECK-OPT /home/rintaro/Repositories/swift-oss/swift/test/SILGen/global_resilience.swift
--
Exit Code: 23

Command Output (stderr):
--

=================================================================
==15627==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #&#8203;0 0xac2376 in posix_memalign (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0xac2376)
    #&#8203;1 0x143db63 in swift::SILModule::allocateInst(unsigned int, unsigned int) const (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0x143db63)
    #&#8203;2 0x142f662 in swift::StructInst::create(swift::SILDebugLocation, swift::SILType, llvm::ArrayRef<swift::SILValue>, swift::SILModule&, bool) (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0x142f662)
    #&#8203;3 0xeb5dcd in swift::SILBuilder::createStruct(swift::SILLocation, swift::SILType, llvm::ArrayRef<swift::SILValue>) (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0xeb5dcd)
    #&#8203;4 0x117108d in swift::SILCloner<swift::StaticInitCloner>::visitStructInst(swift::StructInst*) (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0x117108d)
    #&#8203;5 0x1165293 in swift::StaticInitCloner::clone(swift::SingleValueInstruction*) (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0x1165293)
    #&#8203;6 0x1296ee7 in swift::StaticInitCloner::appendToInitializer(swift::SILGlobalVariable*, swift::SingleValueInstruction*) (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0x1296ee7)
    #&#8203;7 0x1292c44 in (anonymous namespace)::SILGlobalOpt::run() (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0x1292c44)
    #&#8203;8 0x1291a98 in (anonymous namespace)::SILGlobalOptPass::run() (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0x1291a98)
    #&#8203;9 0xfb95ad in swift::SILPassManager::runModulePass(unsigned int) (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0xfb95ad)
    #&#8203;10 0xfb9f51 in swift::SILPassManager::execute() (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0xfb9f51)
    #&#8203;11 0xbc6efa in swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0xbc6efa)
    #&#8203;12 0xfc2270 in swift::runSILOptimizationPasses(swift::SILModule&) (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0xfc2270)
    #&#8203;13 0xdbbcd6 in swift::CompilerInstance::performSILProcessing(swift::SILModule*, swift::UnifiedStatsReporter*) (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0xdbbcd6)
    #&#8203;14 0xb49853 in performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0xb49853)
    #&#8203;15 0xb460e6 in swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0xb460e6)
    #&#8203;16 0xae80f6 in main (/home/rintaro/Repositories/swift-oss/build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift+0xae80f6)
    #&#8203;17 0x7f89aa43eb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

SUMMARY: LeakSanitizer: 96 byte(s) leaked in 1 allocation(s).

--
@rintaro
Copy link
Mannequin Author

rintaro mannequin commented Aug 24, 2019

Many other SIL/SILOptimizer test cases also fail with similar trace.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself memory leak bug: Memory leak
Projects
None yet
Development

No branches or pull requests

0 participants