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-10015] values.map(Result.success) raises assertion failure #52418

Closed
swift-ci opened this issue Feb 28, 2019 · 7 comments
Closed

[SR-10015] values.map(Result.success) raises assertion failure #52418

swift-ci opened this issue Feb 28, 2019 · 7 comments
Assignees
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 non-optimized only Flag: An issue whose reproduction requires non-optimized compilation

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-10015
Radar rdar://problem/49241923
Original Reporter mattgallagher (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

Apple Swift version 5.0-dev (LLVM 6ddb64316c, Swift e76b5a8)

Target: x86_64-apple-darwin18.2.0

macOS Mojave 10.14.3 18D109

MacBookPro15,1

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, CompilerCrash, NotOptimizedOnly
Assignee @slavapestov
Priority Medium

md5: a54e2570604c4689bc20a3a12390f449

is duplicated by:

  • SR-10093 Bugs around coercing errors
  • SR-10164 Compiler Crash: Result<T: Swift.Error>.success

Issue Description:

The following code:

import Swift
let x = ["a", "b"]
let results: [Result<String, Error>] = x.map(Result.success)
print(results) 

raises the following assertion:

$ /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-02-26-a.xctoolchain/usr/bin/swiftc test.swift 
Assertion failed: (isa<ArchetypeType>(type)), function addProtocolConformance, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/IRGen/GenProto.cpp, line 2718.
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-02-26-a.xctoolchain/usr/bin/swift -frontend -c -primary-file test.swift -target x86_64-apple-darwin18.2.0 -enable-objc-interop -color-diagnostics -module-name test -o /var/folders/8k/wsn38m712j9fwys6_m92b01w0000gn/T/test-05a7eb.o 
1.  While emitting IR SIL function "@main".
0  swift                    0x000000010588c815 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x000000010588bad5 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x000000010588cdf8 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff71d47b3d _sigtramp + 29
4  swift                    0x0000000106ad4280 cmark_strbuf__initbuf + 127627
5  libsystem_c.dylib        0x00007fff71c051c9 abort + 127
6  libsystem_c.dylib        0x00007fff71bcd868 basename_r + 0
7  swift                    0x0000000101f84dae swift::irgen::NecessaryBindings::addProtocolConformance(swift::CanType, swift::ProtocolConformanceRef) + 238
8  swift                    0x0000000101f8c7da void llvm::function_ref<void (swift::irgen::GenericRequirement)>::callback_fn<swift::irgen::NecessaryBindings::forFunctionInvocations(swift::irgen::IRGenModule&, swift::CanTypeWrapper<swift::SILFunctionType>, swift::SubstitutionMap)::$_6>(long, swift::irgen::GenericRequirement) + 154
9  swift                    0x0000000101f8ae51 void llvm::function_ref<void (swift::irgen::GenericRequirement)>::callback_fn<(anonymous namespace)::PolymorphicConvention::enumerateUnfulfilledRequirements(llvm::function_ref<void (swift::irgen::GenericRequirement)> const&)::$_12>(long, swift::irgen::GenericRequirement) + 161
10 swift                    0x0000000101f7dbb9 swift::irgen::enumerateGenericSignatureRequirements(swift::CanGenericSignature, llvm::function_ref<void (swift::irgen::GenericRequirement)> const&) + 281
11 swift                    0x0000000101f853fe swift::irgen::NecessaryBindings::forFunctionInvocations(swift::irgen::IRGenModule&, swift::CanTypeWrapper<swift::SILFunctionType>, swift::SubstitutionMap) + 238
12 swift                    0x0000000101f3b99b swift::irgen::emitFunctionPartialApplication(swift::irgen::IRGenFunction&, swift::SILFunction&, swift::irgen::FunctionPointer const&, llvm::Value*, swift::irgen::Explosion&, llvm::ArrayRef<swift::SILParameterInfo>, swift::SubstitutionMap, swift::CanTypeWrapper<swift::SILFunctionType>, swift::CanTypeWrapper<swift::SILFunctionType>, swift::CanTypeWrapper<swift::SILFunctionType>, swift::irgen::Explosion&, bool) + 139
13 swift                    0x0000000101ff4a2d swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 48141
14 swift                    0x0000000101fe5533 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 8131
15 swift                    0x0000000101ef060e swift::irgen::IRGenerator::emitGlobalTopLevel() + 734
16 swift                    0x0000000101fbf77e performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1150
17 swift                    0x0000000101fbfcc6 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, llvm::GlobalVariable**) + 86
18 swift                    0x0000000101e567be performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 14750
19 swift                    0x0000000101e520d5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2997
20 swift                    0x0000000101df9042 main + 690
21 libdyld.dylib            0x00007fff71b5ced9 start + 1
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)

This assertion is not raised when optimization `-O` is passed to swiftc (in this case, the code compiles and runs as expected).

This problem occurs in the latest (Feb 26) Trunk Development (master) build and also in Xcode 10.2 beta 3.

@belkadan
Copy link
Contributor

@rjmccall, @slavapestov, does this sound familiar?

@rjmccall
Copy link
Member

No, but it's almost certainly an `Error`-self-conformance bug; I'll take it.

@weissi
Copy link
Member

weissi commented Apr 5, 2019

@slavapestov
Copy link
Member

#24085

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Aug 9, 2019

mattgallagher (JIRA User), Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna"

@swift-ci
Copy link
Collaborator Author

swift-ci commented Aug 9, 2019

Comment by Matt Gallagher (JIRA)

I can confirm the problem no longer occurs in Apple Swift version 5.1 (swiftlang-1100.0.266.1 clang-1100.0.32.1)

@swift-ci
Copy link
Collaborator Author

swift-ci commented Aug 9, 2019

Comment by Matt Gallagher (JIRA)

Confirm fixed.

@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
This issue was closed.
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 non-optimized only Flag: An issue whose reproduction requires non-optimized compilation
Projects
None yet
Development

No branches or pull requests

6 participants