Swift 2b5: swiftc crash merging module using (apparently valid) recursive type constraint
Originator: | rix.rob | ||
Number: | rdar://22205712 | Date Originated: | 09-Aug-2015 03:36 PM |
Status: | Open | Resolved: | |
Product: | Developer Tools | Product Version: | Xcode-beta (7A176x) |
Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Summary: I was astonished that this compiles, but subsequently bemused that it crashes while merging the module. Steps to Reproduce: 1. A module compiled from code: protocol P { typealias T } enum E<F : P where F.T == E<F>> { indirect case Roll(F.T) } Expected Results: should not crash swiftc Actual Results: but totally does: rob@Resonance ~/Desktop> swiftc -emit-module boom.swift; and ./boom 0 swift 0x0000000111967bbb llvm::sys::PrintStackTrace(__sFILE*) + 43 1 swift 0x00000001119682fb SignalHandler(int) + 379 2 libsystem_platform.dylib 0x00007fff992d8eaa _sigtramp + 26 3 libsystem_platform.dylib 000000000000000000 _sigtramp + 1725067632 4 swift 0x00000001100d539e swift::GenericParamList::addNestedArchetypes(swift::ArchetypeType*, llvm::SmallPtrSetImpl<swift::ArchetypeType*>&, llvm::SmallVectorImpl<swift::ArchetypeType*>&) + 30 5 swift 0x00000001100d5663 swift::GenericParamList::deriveAllArchetypes(llvm::ArrayRef<swift::GenericTypeParamDecl*>, llvm::SmallVectorImpl<swift::ArchetypeType*>&) + 355 6 swift 0x000000010fd11a21 swift::ModuleFile::maybeReadGenericParams(swift::DeclContext*, llvm::BitstreamCursor&, swift::GenericParamList*) + 561 7 swift 0x000000010fd0b86d swift::ModuleFile::getDecl(llvm::Fixnum<31u, unsigned int>, llvm::Optional<swift::DeclContext*>) + 14605 8 swift 0x000000010fd05d72 swift::ModuleFile::getType(llvm::Fixnum<31u, unsigned int>) + 3026 9 swift 0x000000010fd0795b swift::ModuleFile::getType(llvm::Fixnum<31u, unsigned int>) + 10171 10 swift 0x000000010fd0c70f swift::ModuleFile::getDecl(llvm::Fixnum<31u, unsigned int>, llvm::Optional<swift::DeclContext*>) + 18351 11 swift 0x000000010fd11ddd swift::ModuleFile::maybeReadGenericParams(swift::DeclContext*, llvm::BitstreamCursor&, swift::GenericParamList*) + 1517 12 swift 0x000000010fd0b86d swift::ModuleFile::getDecl(llvm::Fixnum<31u, unsigned int>, llvm::Optional<swift::DeclContext*>) + 14605 13 swift 0x000000010fd3771a swift::ModuleFile::getTopLevelDecls(llvm::SmallVectorImpl<swift::Decl*>&) + 666 14 swift 0x000000010fd4d7f8 swift::serialization::Serializer::writeAST(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>) + 648 15 swift 0x000000010fd507a7 swift::serialization::Serializer::writeToStream(llvm::raw_ostream&, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SILModule const*, swift::SerializationOptions const&) + 135 16 swift 0x000000010fd51282 withOutputFile(swift::ASTContext&, llvm::StringRef, llvm::function_ref<void (llvm::raw_ostream&)>) + 226 17 swift 0x000000010fd510b5 swift::serialize(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SerializationOptions const&, swift::SILModule const*) + 149 18 swift 0x000000010f92b899 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 13945 19 swift 0x000000010f927fc8 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2728 20 swift 0x000000010f92402f main + 2015 21 libdyld.dylib 0x00007fff97a025ad start + 1 Stack dump: 0. Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-module /var/folders/9y/f7n4rvx901nctm_5d16c1wm40000gn/T/boom-b39a27.swiftmodule -parse-as-library -target x86_64-apple-darwin15.0.0 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -emit-module-doc-path boom.swiftdoc -color-diagnostics -module-name boom -o boom.swiftmodule 1. While reading from /var/folders/9y/f7n4rvx901nctm_5d16c1wm40000gn/T/boom-b39a27.swiftmodule 2. While deserializing decl #4 (ENUM_DECL) 3. While deserializing 'F' (GenericTypeParamDecl #10) 4. While deserializing decl #4 (ENUM_DECL) <unknown>:0: error: unable to execute command: Segmentation fault: 11 <unknown>:0: error: merge-module command failed due to signal (use -v to see invocation) Regression: This apparently compiles just fine if you don’t put it in a module, i.e. if you omit the `-emit-modules` flag to swiftc. Notes: N/A
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!