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-10493] compiler crasher on [Substring].map(Int.init) #52893

Closed
weissi opened this issue Apr 16, 2019 · 0 comments
Closed

[SR-10493] compiler crasher on [Substring].map(Int.init) #52893

weissi opened this issue Apr 16, 2019 · 0 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 regression swift 5.0

Comments

@weissi
Copy link
Member

weissi commented Apr 16, 2019

Previous ID SR-10493
Radar None
Original Reporter @weissi
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 5.0Regression, CompilerCrash
Assignee None
Priority Medium

md5: eb3478b527711a68d9eeb65a5f4be90b

duplicates:

Issue Description:

this program

let allCL: [Substring] = ["1"[...]]
if let cl = allCL.first.map(Int.init), allCL.count == 1 {
    print("cool")
}

crashes Swift 5.0 with

$ jw-swift-5.0 swift /tmp/repro.swift
Assertion failed: (AffectedDecl), function RequirementFailure, file /Users/buildnode/jenkins/workspace/oss-swift-5.0-package-osx/swift/lib/Sema/CSDiagnostics.h, line 172.
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-5.0-RELEASE.xctoolchain/usr/bin/swift -frontend -interpret /tmp/repro.swift -enable-objc-interop -sdk /Volumes/XcodeStuff/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name repro 
1.  While type-checking statement at [/tmp/repro.swift:2:1 - line:4:1] RangeText="if let cl = allCL.first.map(Int.init), allCL.count == 1 {
    print("cool")
"
2.  While type-checking statement at [/tmp/repro.swift:2:1 - line:4:1] RangeText="if let cl = allCL.first.map(Int.init), allCL.count == 1 {
    print("cool")
"
3.  While type-checking expression at [/tmp/repro.swift:2:13 - line:2:37] RangeText="allCL.first.map(Int.init"
0  swift                    0x0000000110c9c245 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x0000000110c9b4e5 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x0000000110c9c832 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff65365b5d _sigtramp + 29
4  swift                    0x0000000111fb29a1 cmark_strbuf__initbuf + 131204
5  libsystem_c.dylib        0x00007fff652256a6 abort + 127
6  libsystem_c.dylib        0x00007fff651ee20d basename_r + 0
7  swift                    0x000000010dff47da swift::constraints::RequirementFailure::RequirementFailure(swift::constraints::ConstraintSystem&, swift::Expr*, swift::RequirementKind, swift::constraints::ConstraintLocator*) + 330
8  swift                    0x000000010dff3ae7 swift::constraints::MissingConformance::diagnose(swift::Expr*, bool) const + 55
9  swift                    0x000000010df78a14 swift::Expr* llvm::function_ref<swift::Expr* (swift::Expr*)>::callback_fn<swift::constraints::ConstraintSystem::applySolutionFixes(swift::Expr*, swift::constraints::Solution const&)::$_11>(long, swift::Expr*) + 244
10 swift                    0x000000010e3fdcae swift::Expr::forEachChildExpr(llvm::function_ref<swift::Expr* (swift::Expr*)>)::ChildWalker::walkToExprPre(swift::Expr*) + 14
11 swift                    0x000000010e394199 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 201
12 swift                    0x000000010e396b4f (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) + 207
13 swift                    0x000000010e393a84 swift::Expr::walk(swift::ASTWalker&) + 84
14 swift                    0x000000010e3f0303 swift::Expr::forEachChildExpr(llvm::function_ref<swift::Expr* (swift::Expr*)>) + 51
15 swift                    0x000000010df58478 swift::constraints::ConstraintSystem::applySolutionFixes(swift::Expr*, swift::constraints::Solution const&) + 536
16 swift                    0x000000010df586bb swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool) + 59
17 swift                    0x000000010e08bb47 swift::TypeChecker::typeCheckExpressionImpl(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener&, swift::constraints::ConstraintSystem*) + 1159
18 swift                    0x000000010e08d19d swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*, bool) + 397
19 swift                    0x000000010e08d8e5 swift::TypeChecker::typeCheckStmtCondition(llvm::MutableArrayRef<swift::StmtConditionElement>&, swift::DeclContext*, swift::Diag<>) + 357
20 swift                    0x000000010e122190 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 2192
21 swift                    0x000000010e124518 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::Stmt>(swift::Stmt*&) + 136
22 swift                    0x000000010e121a08 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 264
23 swift                    0x000000010e120d18 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 136
24 swift                    0x000000010e120e2e swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 174
25 swift                    0x000000010e1423bf swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 927
26 swift                    0x000000010d8fdce6 swift::CompilerInstance::parseAndTypeCheckMainFileUpTo(swift::SourceFile::ASTStage_t, swift::PersistentParserState&, swift::DelayedParsingCallbacks*, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>) + 502
27 swift                    0x000000010d8fc663 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 435
28 swift                    0x000000010d8fbd17 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 615
29 swift                    0x000000010d0dc188 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1192
30 swift                    0x000000010d0dac78 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3016
31 swift                    0x000000010d08cd52 main + 690
32 libdyld.dylib            0x00007fff651803d5 start + 1
/Users/johannes/local/bin/jw-swift-5.0: line 3: 41924 Abort trap: 6           jw-other-swift 5.0-RELEASE "$@"
@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 regression swift 5.0
Projects
None yet
Development

No branches or pull requests

2 participants