Uploaded image for project: 'Swift'
  1. Swift
  2. SR-9885

Leaks in Casting Machinery on Linux in test/Interpreter/generic_casts.swift

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:

      Description

      I discovered this while running swift with asan on Linux (which also checks for leaks). You should be able to just compile generic_casts.swift with -sanitize=address to reproduce.

      ******************** TEST 'Swift(linux-x86_64) :: Interpreter/generic_casts.swift' FAILED ********************
      Script:
      --
      : 'RUN: at line 1';   rm -rf "/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp" && mkdir -p "/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp" && /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/bin/swiftc -target x86_64-unknown-linux-gnu  -module-cache-path '/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 4   -module-cache-path '/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' /Users/docker_user/src/swift/test/Interpreter/generic_casts.swift -o /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out -module-name main -sanitize=address -g && echo /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out && /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out | '/usr/bin/python' '/Users/docker_user/src/swift/utils/PathSanitizingFileCheck' --sanitize BUILD_DIR='/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64' --sanitize SOURCE_DIR='/Users/docker_user/src/swift' --use-filecheck '/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/llvm-linux-x86_64/bin/FileCheck' /Users/docker_user/src/swift/test/Interpreter/generic_casts.swift
      : 'RUN: at line 2';   /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/bin/swiftc -target x86_64-unknown-linux-gnu  -module-cache-path '/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 4   -O /Users/docker_user/src/swift/test/Interpreter/generic_casts.swift -o /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out.optimized
      : 'RUN: at line 3';   echo /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out.optimized
      : 'RUN: at line 4';    /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out.optimized | '/usr/bin/python' '/Users/docker_user/src/swift/utils/PathSanitizingFileCheck' --sanitize BUILD_DIR='/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64' --sanitize SOURCE_DIR='/Users/docker_user/src/swift' --use-filecheck '/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/llvm-linux-x86_64/bin/FileCheck' /Users/docker_user/src/swift/test/Interpreter/generic_casts.swift
      --
      Exit Code: 2
      
      Command Output (stdout):
      --
      /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out
      
      --
      Command Output (stderr):
      --
      LLVMSymbolizer: error reading file: No such file or directory
      
      =================================================================
      ==128919==ERROR: LeakSanitizer: detected memory leaks
      
      Direct leak of 96 byte(s) in 2 object(s) allocated from:
          #0 0x5565a3d7e093 in malloc /Users/docker_user/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
          #1 0x7fdb8076b381 in swift_slowAlloc /Users/docker_user/src/swift/stdlib/public/runtime/Heap.cpp:80:9
          #2 0x7fdb80766040 in _dynamicCastToExistential(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetExistentialTypeMetadata<swift::InProcess> const*, swift::DynamicCastFlags)::$_9::operator()() const /Users/docker_user/src/swift/stdlib/public/runtime/Casting.cpp:785:19
          #3 0x7fdb80766040 in _dynamicCastToExistential(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetExistentialTypeMetadata<swift::InProcess> const*, swift::DynamicCastFlags) /Users/docker_user/src/swift/stdlib/public/runtime/Casting.cpp:854
          #4 0x7fff50c53f7f  ([stack]+0x1ef7f)
      

        Attachments

          Activity

            People

            Assignee:
            mikeash Mike Ash
            Reporter:
            gottesmm Michael Gottesman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: