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

GenStruct.cpp:673: Assertion `offset >= NextOffset && "adding fields out of order"'

    XMLWordPrintable

    Details

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

      Description

      When compiling the attached Swift package the compiler crashes after failing the following assertion: swift: /build/swiftc/src/swift/lib/IRGen/GenStruct.cpp:673: void (anonymous namespace)::ClangRecordLowering::addField(swift::VarDecl *, swift::irgen::Size, const swift::irgen::LoadableTypeInfo &): Assertion `offset >= NextOffset && "adding fields out of order"' failed.

      The full log of the build on Arch Linux can be seen below. A similar build for OS X is attached.

      NOTE: The Package.swift file attached points to FFmpeg headers configured for Arch Linux. If you are on OS X and use Homebrew to install FFmpeg you can change the module map for CFFmpeg to point to /usr/local/Cellar/ffmpeg/3.0/include/*/.h.

      ⇨  swift build
      Cloning ssh://git@github.com/RLovelett/CFFmpeg.swift.git
      Resolved version: 1.0.1
      Compiling Swift Module 'swiftcompilerbug' (1 sources)
      swift: /build/swiftc/src/swift/lib/IRGen/GenStruct.cpp:673: void (anonymous namespace)::ClangRecordLowering::addField(swift::VarDecl *, swift::irgen::Size, const swift::irgen::LoadableTypeInfo &): Assertion `offset >= NextOffset && "adding fields out of order"' failed.
      0  swift           0x00000000031285e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
      1  swift           0x0000000003126e16 llvm::sys::RunSignalHandlers() + 54
      2  swift           0x0000000003128cd6
      3  libpthread.so.0 0x00007f101e666e80
      4  libc.so.6       0x00007f101cd7b2a8 gsignal + 56
      5  libc.so.6       0x00007f101cd7c72a abort + 362
      6  libc.so.6       0x00007f101cd741b7
      7  libc.so.6       0x00007f101cd74262
      8  swift           0x0000000000852d63
      9  swift           0x0000000000851b7e swift::irgen::TypeConverter::convertStructType(swift::TypeBase*, swift::CanType, swift::StructDecl*) + 4110
      10 swift           0x000000000085d477 swift::irgen::TypeConverter::convertAnyNominalType(swift::CanType, swift::NominalTypeDecl*) + 343
      11 swift           0x000000000085cb63 swift::irgen::TypeConverter::convertType(swift::CanType) + 243
      12 swift           0x000000000085be49 swift::irgen::TypeConverter::getTypeEntry(swift::CanType) + 601
      13 swift           0x000000000085b860 swift::irgen::IRGenModule::getTypeInfo(swift::SILType) + 48
      14 swift           0x000000000085b5de swift::irgen::IRGenModule::getTypeInfoForUnlowered(swift::Type) + 174
      15 swift           0x00000000007d19a2 swift::irgen::IRGenModule::hasMetadataPattern(swift::NominalTypeDecl*) + 82
      16 swift           0x000000000080f7b0
      17 swift           0x00000000007fdd9d swift::irgen::emitLazyCacheAccessFunction(swift::irgen::IRGenModule&, llvm::Function*, llvm::GlobalVariable*, llvm::function_ref<llvm::Value* (swift::irgen::IRGenFunction&)> const&) + 541
      18 swift           0x00000000007fe1e0
      19 swift           0x00000000007fdf64
      20 swift           0x000000000080ea63
      21 swift           0x000000000080d1fb
      22 swift           0x000000000080f785
      23 swift           0x00000000007fdd9d swift::irgen::emitLazyCacheAccessFunction(swift::irgen::IRGenModule&, llvm::Function*, llvm::GlobalVariable*, llvm::function_ref<llvm::Value* (swift::irgen::IRGenFunction&)> const&) + 541
      24 swift           0x00000000007fe1e0
      25 swift           0x00000000007fdf64
      26 swift           0x000000000080ea63
      27 swift           0x000000000080d1fb
      28 swift           0x000000000080f785
      29 swift           0x00000000007fdd9d swift::irgen::emitLazyCacheAccessFunction(swift::irgen::IRGenModule&, llvm::Function*, llvm::GlobalVariable*, llvm::function_ref<llvm::Value* (swift::irgen::IRGenFunction&)> const&) + 541
      30 swift           0x00000000007fe1e0
      31 swift           0x00000000007fdf64
      32 swift           0x00000000008002e9 swift::irgen::emitFieldTypeAccessor(swift::irgen::IRGenModule&, swift::NominalTypeDecl*, llvm::Function*, llvm::ArrayRef<swift::irgen::FieldTypeInfo>) + 2601
      33 swift           0x00000000007ce5e9 swift::irgen::IRGenModuleDispatcher::emitLazyDefinitions() + 601
      34 swift           0x00000000007b7f79
      35 swift           0x00000000007b8413 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 67
      36 swift           0x0000000000785589
      37 swift           0x0000000000780c31 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2545
      38 swift           0x000000000077c3ad main + 2557
      39 libc.so.6       0x00007f101cd68710 __libc_start_main + 240
      40 swift           0x000000000077b8a9 _start + 41
      Stack dump:
      0.	Program arguments: /usr/bin/swift -frontend -c -primary-file /tmp/swift-compiler-bug/Sources/main.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /tmp/swift-compiler-bug/.build/debug -enable-testing -g -D SWIFT_PACKAGE -Xcc -fmodule-map-file=/tmp/swift-compiler-bug/Packages/CFFmpeg.swift-1.0.1/module.modulemap -emit-module-doc-path /tmp/swift-compiler-bug/.build/debug/swiftcompilerbug.build/main~partial.swiftdoc -Onone -module-name swiftcompilerbug -emit-module-path /tmp/swift-compiler-bug/.build/debug/swiftcompilerbug.build/main~partial.swiftmodule -emit-dependencies-path /tmp/swift-compiler-bug/.build/debug/swiftcompilerbug.build/main.d -emit-reference-dependencies-path /tmp/swift-compiler-bug/.build/debug/swiftcompilerbug.build/main.swiftdeps -o /tmp/swift-compiler-bug/.build/debug/swiftcompilerbug.build/main.swift.o
      1.	While converting type 'AVFilterLink' (declared at [<invalid loc> - <invalid loc>])
      <unknown>:0: error: unable to execute command: Aborted
      <unknown>:0: error: compile command failed due to signal (use -v to see invocation)
      <unknown>:0: error: build had 1 command failures
      error: exit(1): /usr/bin/swift-build-tool -f /tmp/swift-compiler-bug/.build/debug.yaml default
      

        Attachments

        1. sr-846.log
          14 kB
        2. swift.log
          14 kB
        3. swift-4-compiler-bug.tar.xz
          1.0 kB
        4. swift-compiler-bug.tar.xz
          10 kB

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            rlovelett Ryan Lovelett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: