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-846] GenStruct.cpp:673: Assertion `offset >= NextOffset && "adding fields out of order"' #43458

Open
swift-ci opened this issue Feb 28, 2016 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software IRGen LLVM IR generation

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-846
Radar rdar://24879326
Original Reporter rlovelett (JIRA User)
Type Bug

Attachment: Download

Environment
  • OSX 10.11.3 (15D21) - Xcode Version 7.3 beta (7D152p) - swift-DEVELOPMENT-SNAPSHOT-2016-02-25-a.xctoolchain
  • Arch Linux 4.2.5-1 - clang version 3.7.1 (tags/RELEASE_371/final) - Swift version 3.0-dev (LLVM 0d07a5d3d5, Clang 3d015ad63e, Swift 527c814)

  • macOS Sierra 10.12.6 (16G29) - Xcode Version 9.0 beta 4 (9M189t) - Apple Swift version 4.0 (swiftlang-900.0.54.11 clang-900.0.31)

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

md5: 241d7794eb6e8b63451730c46b8d9519

Issue 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
@gottesmm
Copy link
Member

IRGen crasher! I filed: rdar://24879326.

@aschwaighofer
Copy link
Member

Ryan does this still reproduce with a recent beta of Xcode?

@swift-ci
Copy link
Collaborator Author

swift-ci commented Aug 5, 2017

Comment by Ryan Lovelett (JIRA)

aschwaighofer@apple.com (JIRA User) it sure is. I'm not 100% sure its the same exact crash as before but it definitely still crashes. I just updated everything for Swift and SwiftPM 4 (and minimized some more of the code in the CFFmpeg library).

To reproduce I did these steps.

cd $(mktemp -d)
wget https://bugs.swift.org/secure/attachment/12500/swift-4-compiler-bug.tar.xz
tar xvf swift-4-compiler-bug.tar.xz
cd swift-4-compiler-bug/
swift build

The swift build step produces the output in sr-846.log. I'll note that sometimes it does not give that whole log. Sometimes it just says: error: unable to execute command: Segmentation fault: 11 but it always crashes.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Aug 5, 2017

Comment by Ryan Lovelett (JIRA)

aschwaighofer@apple.com (JIRA User) I also updated the Environment details above to include the configuration of the crasher I just reported.

I'll provide it here too for completeness.

macOS Sierra 10.12.6 (16G29)
Xcode Version 9.0 beta 4 (9M189t)
Apple Swift version 4.0 (swiftlang-900.0.54.11 clang-900.0.31)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 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 crash Bug: A crash, i.e., an abnormal termination of software IRGen LLVM IR generation
Projects
None yet
Development

No branches or pull requests

4 participants