From f62cb8f91a2e6f53bd927a4fcff0d3be11c47d90 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Thu, 19 Jun 2025 14:42:00 +0100 Subject: [PATCH 1/3] [test] Use guard malloc in `4c84d3d852cdd1d4.swift` This should hopefully make it crash reliably. --- validation-test/compiler_crashers_2/4c84d3d852cdd1d4.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/validation-test/compiler_crashers_2/4c84d3d852cdd1d4.swift b/validation-test/compiler_crashers_2/4c84d3d852cdd1d4.swift index 7888d6554a8de..c9dfed1ef50e8 100644 --- a/validation-test/compiler_crashers_2/4c84d3d852cdd1d4.swift +++ b/validation-test/compiler_crashers_2/4c84d3d852cdd1d4.swift @@ -1,4 +1,7 @@ // {"signature":"swift::ProtocolConformanceRef::forAbstract(swift::Type, swift::ProtocolDecl*)"} -// RUN: not --crash %target-swift-frontend -typecheck %s +// RUN: env DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib not --crash %target-swift-frontend -typecheck %s +// REQUIRES: OS=macosx +// REQUIRES: target-same-as-host +// REQUIRES: no_asan var sixDoubles : Double "six has the value [\( ( sixDoubles \[]) }0 \0\0 \0 \sixDoubles)" From 61aa5a0b0771ab08abcffd6163f379a33edd733e Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Tue, 17 Jun 2025 09:30:19 +0100 Subject: [PATCH 2/3] [test] Add some more known type-checker crashers --- .../compiler_crashers_2/12b9d4c832862a3.swift | 7 +++++++ .../compiler_crashers_2/1a9cf8aaa2cfa83f.swift | 5 +++++ .../compiler_crashers_2/1b94fce977ad935d.swift | 3 +++ .../compiler_crashers_2/29cff4b25b728d.swift | 3 +++ .../compiler_crashers_2/438c8a321d9be3de.swift | 4 ++++ .../compiler_crashers_2/489d4cf70584858.swift | 3 +++ .../compiler_crashers_2/4ae85881765dc0db.swift | 4 ++++ .../compiler_crashers_2/4c48b3ae4546aed.swift | 3 +++ .../compiler_crashers_2/4e921915ae337fb5.swift | 3 +++ .../compiler_crashers_2/50b52589da464db0.swift | 3 +++ .../compiler_crashers_2/548b48b935d4153a.swift | 4 ++++ .../compiler_crashers_2/557cde75b2fa4b56.swift | 4 ++++ .../compiler_crashers_2/5cbe6a68da313ea9.swift | 6 ++++++ .../compiler_crashers_2/5e8f12d4126e38b.swift | 7 +++++++ .../compiler_crashers_2/5ed6119e7b5941e8.swift | 4 ++++ .../compiler_crashers_2/5f942981131dbcab.swift | 3 +++ .../compiler_crashers_2/624dafcf406667e8.swift | 5 +++++ .../compiler_crashers_2/72eed0e8ff21c1a.swift | 5 +++++ .../compiler_crashers_2/7375195b753c3ca3.swift | 3 +++ .../compiler_crashers_2/76b298dbdff34f1.swift | 3 +++ .../compiler_crashers_2/84cb3a91833322c6.swift | 3 +++ .../compiler_crashers_2/8b3bbe2fe5878590.swift | 10 ++++++++++ .../compiler_crashers_2/8d73bb4170a0c447.swift | 3 +++ .../compiler_crashers_2/93b241538559442a.swift | 5 +++++ .../compiler_crashers_2/9ae5dcaffa1a80.swift | 6 ++++++ .../compiler_crashers_2/9c465a4c5d33b28c.swift | 3 +++ .../compiler_crashers_2/a014efdc2cfb729.swift | 4 ++++ .../compiler_crashers_2/af7dc08992398ff.swift | 4 ++++ .../compiler_crashers_2/b2548f4cd9bcd52d.swift | 4 ++++ .../compiler_crashers_2/b33dbab8ed3643.swift | 7 +++++++ .../compiler_crashers_2/bf67776f769fa0f1.swift | 5 +++++ .../compiler_crashers_2/c3b37ed583f2402b.swift | 5 +++++ .../compiler_crashers_2/c8563a4a60b27cf3.swift | 7 +++++++ .../compiler_crashers_2/ca37c33bbdab835.swift | 3 +++ .../compiler_crashers_2/cec5966bff434957.swift | 4 ++++ .../compiler_crashers_2/dc31b2ef4315855a.swift | 5 +++++ .../compiler_crashers_2/e6a483a39992886f.swift | 3 +++ .../compiler_crashers_2/e714818ef0d04b52.swift | 4 ++++ .../compiler_crashers_2/eb61865acc77c50.swift | 3 +++ .../compiler_crashers_2/f3ef80da3095d840.swift | 4 ++++ .../compiler_crashers_2/f8296a9a293c6ae7.swift | 5 +++++ .../compiler_crashers_2/fca26dd570bcdf1c.swift | 5 +++++ .../compiler_crashers_2_fixed/2e698e9f7b48e8c.swift | 3 +++ .../compiler_crashers_2_fixed/4d5c64ab845e174f.swift | 3 +++ 44 files changed, 190 insertions(+) create mode 100644 validation-test/compiler_crashers_2/12b9d4c832862a3.swift create mode 100644 validation-test/compiler_crashers_2/1a9cf8aaa2cfa83f.swift create mode 100644 validation-test/compiler_crashers_2/1b94fce977ad935d.swift create mode 100644 validation-test/compiler_crashers_2/29cff4b25b728d.swift create mode 100644 validation-test/compiler_crashers_2/438c8a321d9be3de.swift create mode 100644 validation-test/compiler_crashers_2/489d4cf70584858.swift create mode 100644 validation-test/compiler_crashers_2/4ae85881765dc0db.swift create mode 100644 validation-test/compiler_crashers_2/4c48b3ae4546aed.swift create mode 100644 validation-test/compiler_crashers_2/4e921915ae337fb5.swift create mode 100644 validation-test/compiler_crashers_2/50b52589da464db0.swift create mode 100644 validation-test/compiler_crashers_2/548b48b935d4153a.swift create mode 100644 validation-test/compiler_crashers_2/557cde75b2fa4b56.swift create mode 100644 validation-test/compiler_crashers_2/5cbe6a68da313ea9.swift create mode 100644 validation-test/compiler_crashers_2/5e8f12d4126e38b.swift create mode 100644 validation-test/compiler_crashers_2/5ed6119e7b5941e8.swift create mode 100644 validation-test/compiler_crashers_2/5f942981131dbcab.swift create mode 100644 validation-test/compiler_crashers_2/624dafcf406667e8.swift create mode 100644 validation-test/compiler_crashers_2/72eed0e8ff21c1a.swift create mode 100644 validation-test/compiler_crashers_2/7375195b753c3ca3.swift create mode 100644 validation-test/compiler_crashers_2/76b298dbdff34f1.swift create mode 100644 validation-test/compiler_crashers_2/84cb3a91833322c6.swift create mode 100644 validation-test/compiler_crashers_2/8b3bbe2fe5878590.swift create mode 100644 validation-test/compiler_crashers_2/8d73bb4170a0c447.swift create mode 100644 validation-test/compiler_crashers_2/93b241538559442a.swift create mode 100644 validation-test/compiler_crashers_2/9ae5dcaffa1a80.swift create mode 100644 validation-test/compiler_crashers_2/9c465a4c5d33b28c.swift create mode 100644 validation-test/compiler_crashers_2/a014efdc2cfb729.swift create mode 100644 validation-test/compiler_crashers_2/af7dc08992398ff.swift create mode 100644 validation-test/compiler_crashers_2/b2548f4cd9bcd52d.swift create mode 100644 validation-test/compiler_crashers_2/b33dbab8ed3643.swift create mode 100644 validation-test/compiler_crashers_2/bf67776f769fa0f1.swift create mode 100644 validation-test/compiler_crashers_2/c3b37ed583f2402b.swift create mode 100644 validation-test/compiler_crashers_2/c8563a4a60b27cf3.swift create mode 100644 validation-test/compiler_crashers_2/ca37c33bbdab835.swift create mode 100644 validation-test/compiler_crashers_2/cec5966bff434957.swift create mode 100644 validation-test/compiler_crashers_2/dc31b2ef4315855a.swift create mode 100644 validation-test/compiler_crashers_2/e6a483a39992886f.swift create mode 100644 validation-test/compiler_crashers_2/e714818ef0d04b52.swift create mode 100644 validation-test/compiler_crashers_2/eb61865acc77c50.swift create mode 100644 validation-test/compiler_crashers_2/f3ef80da3095d840.swift create mode 100644 validation-test/compiler_crashers_2/f8296a9a293c6ae7.swift create mode 100644 validation-test/compiler_crashers_2/fca26dd570bcdf1c.swift create mode 100644 validation-test/compiler_crashers_2_fixed/2e698e9f7b48e8c.swift create mode 100644 validation-test/compiler_crashers_2_fixed/4d5c64ab845e174f.swift diff --git a/validation-test/compiler_crashers_2/12b9d4c832862a3.swift b/validation-test/compiler_crashers_2/12b9d4c832862a3.swift new file mode 100644 index 0000000000000..3519a15e6ec66 --- /dev/null +++ b/validation-test/compiler_crashers_2/12b9d4c832862a3.swift @@ -0,0 +1,7 @@ +// {"signature":"swift::rewriting::RewriteSystem::verifyRewriteRules(swift::rewriting::RewriteSystem::ValidityPolicy) const"} +// RUN: not --crash %target-swift-frontend -typecheck %s +protocol a { associatedtype b : Collection } +struct c < d : Collection where d.Element : a, + e == d.Element.b.Element struct f < d : Collection where d.Element : a, + d.Element.b.Element == d.Index extension c where g == f, + d : RangeReplaceableCollection diff --git a/validation-test/compiler_crashers_2/1a9cf8aaa2cfa83f.swift b/validation-test/compiler_crashers_2/1a9cf8aaa2cfa83f.swift new file mode 100644 index 0000000000000..13b06b0aaccc2 --- /dev/null +++ b/validation-test/compiler_crashers_2/1a9cf8aaa2cfa83f.swift @@ -0,0 +1,5 @@ +// {"signature":"swift::InFlightDiagnostic swift::DiagnosticEngine::diagnose(swift::Decl const*, swift::Diag, swift::detail::PassArgument::type)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +// REQUIRES: objc_interop +@objcMembers class a open extension a { + func 0.0 diff --git a/validation-test/compiler_crashers_2/1b94fce977ad935d.swift b/validation-test/compiler_crashers_2/1b94fce977ad935d.swift new file mode 100644 index 0000000000000..ce03dee9e7b06 --- /dev/null +++ b/validation-test/compiler_crashers_2/1b94fce977ad935d.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::DifferentiableAttr::DifferentiableAttr(bool, swift::SourceLoc, swift::SourceRange, swift::DifferentiabilityKind, llvm::ArrayRef, swift::TrailingWhereClause*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +func a(@differentiable _ = diff --git a/validation-test/compiler_crashers_2/29cff4b25b728d.swift b/validation-test/compiler_crashers_2/29cff4b25b728d.swift new file mode 100644 index 0000000000000..0bdf27b4772fd --- /dev/null +++ b/validation-test/compiler_crashers_2/29cff4b25b728d.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::TypeChecker::typeCheckStmtConditionElement(swift::StmtConditionElement&, bool&, swift::DeclContext*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +a guard let b let a = b diff --git a/validation-test/compiler_crashers_2/438c8a321d9be3de.swift b/validation-test/compiler_crashers_2/438c8a321d9be3de.swift new file mode 100644 index 0000000000000..5e775839f2b52 --- /dev/null +++ b/validation-test/compiler_crashers_2/438c8a321d9be3de.swift @@ -0,0 +1,4 @@ +// {"signature":"swift::constraints::SameTypeRequirementFailure::SameTypeRequirementFailure(swift::constraints::Solution const&, swift::Type, swift::Type, swift::constraints::ConstraintLocator*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +protocol a struct b extension Dictionary : a where Value == let func !c { + let d : [Int:b] let : a = d diff --git a/validation-test/compiler_crashers_2/489d4cf70584858.swift b/validation-test/compiler_crashers_2/489d4cf70584858.swift new file mode 100644 index 0000000000000..916c0eec6cc3b --- /dev/null +++ b/validation-test/compiler_crashers_2/489d4cf70584858.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::Parser::consumeTokenWithoutFeedingReceiver()"} +// RUN: not --crash %target-swift-frontend -typecheck %s +@_extern(a diff --git a/validation-test/compiler_crashers_2/4ae85881765dc0db.swift b/validation-test/compiler_crashers_2/4ae85881765dc0db.swift new file mode 100644 index 0000000000000..83bb804b70627 --- /dev/null +++ b/validation-test/compiler_crashers_2/4ae85881765dc0db.swift @@ -0,0 +1,4 @@ +// {"signature":"diagnoseAmbiguityWithContextualType(swift::constraints::ConstraintSystem&, swift::constraints::SolutionDiff&, llvm::ArrayRef>, llvm::ArrayRef)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +struct a func b< c >(c = a( + func a diff --git a/validation-test/compiler_crashers_2/4c48b3ae4546aed.swift b/validation-test/compiler_crashers_2/4c48b3ae4546aed.swift new file mode 100644 index 0000000000000..1f605ef901a76 --- /dev/null +++ b/validation-test/compiler_crashers_2/4c48b3ae4546aed.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::constraints::ConstraintSystem::recordKeyPath(swift::KeyPathExpr const*, swift::TypeVariableType*, swift::TypeVariableType*, swift::DeclContext*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +enum a { b->a{switch self{case.c(\ d) e diff --git a/validation-test/compiler_crashers_2/4e921915ae337fb5.swift b/validation-test/compiler_crashers_2/4e921915ae337fb5.swift new file mode 100644 index 0000000000000..76c5d63cbd1f4 --- /dev/null +++ b/validation-test/compiler_crashers_2/4e921915ae337fb5.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::NormalProtocolConformance::setTypeWitness(swift::AssociatedTypeDecl*, swift::Type, swift::TypeDecl*) const"} +// RUN: not --crash %target-swift-frontend -typecheck %s +protocol a typealias b = () extension b : a diff --git a/validation-test/compiler_crashers_2/50b52589da464db0.swift b/validation-test/compiler_crashers_2/50b52589da464db0.swift new file mode 100644 index 0000000000000..136cc12ce0a6d --- /dev/null +++ b/validation-test/compiler_crashers_2/50b52589da464db0.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::ExprPatternMatchRequest::evaluate(swift::Evaluator&, swift::ExprPattern const*) const"} +// RUN: not --crash %target-swift-frontend -typecheck %s +enum a { b(c : a){{guard case.b = c diff --git a/validation-test/compiler_crashers_2/548b48b935d4153a.swift b/validation-test/compiler_crashers_2/548b48b935d4153a.swift new file mode 100644 index 0000000000000..6c88f3204a5db --- /dev/null +++ b/validation-test/compiler_crashers_2/548b48b935d4153a.swift @@ -0,0 +1,4 @@ +// {"signature":"swift::NominalType::get(swift::NominalTypeDecl*, swift::Type, swift::ASTContext const&)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +extension() { + struct a extension a diff --git a/validation-test/compiler_crashers_2/557cde75b2fa4b56.swift b/validation-test/compiler_crashers_2/557cde75b2fa4b56.swift new file mode 100644 index 0000000000000..9679a3aea4a29 --- /dev/null +++ b/validation-test/compiler_crashers_2/557cde75b2fa4b56.swift @@ -0,0 +1,4 @@ +// {"signature":"isParamListRepresentableInLanguage(swift::AbstractFunctionDecl const*, swift::ParameterList const*, swift::ObjCReason)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +// REQUIRES: objc_interop +class a { @objc b(@c & d Int) @propertyWrapper enum c diff --git a/validation-test/compiler_crashers_2/5cbe6a68da313ea9.swift b/validation-test/compiler_crashers_2/5cbe6a68da313ea9.swift new file mode 100644 index 0000000000000..1a4b5a675b5e7 --- /dev/null +++ b/validation-test/compiler_crashers_2/5cbe6a68da313ea9.swift @@ -0,0 +1,6 @@ +// {"signature":"swift::AvailabilityScope::verify(swift::AvailabilityScope const*, swift::ASTContext&) const"} +// RUN: not --crash %target-swift-frontend -typecheck %s +if +#available({} + else { + var a diff --git a/validation-test/compiler_crashers_2/5e8f12d4126e38b.swift b/validation-test/compiler_crashers_2/5e8f12d4126e38b.swift new file mode 100644 index 0000000000000..673a6d2bc285c --- /dev/null +++ b/validation-test/compiler_crashers_2/5e8f12d4126e38b.swift @@ -0,0 +1,7 @@ +// {"signature":"swift::ClosureHasResultExprRequest::evaluate(swift::Evaluator&, swift::ClosureExpr*) const"} +// RUN: not --crash %target-swift-frontend -typecheck %s +func a (Int -> Int , Int = +#sourceLocation5 + func b { + a { + $0 diff --git a/validation-test/compiler_crashers_2/5ed6119e7b5941e8.swift b/validation-test/compiler_crashers_2/5ed6119e7b5941e8.swift new file mode 100644 index 0000000000000..8e6c25c463604 --- /dev/null +++ b/validation-test/compiler_crashers_2/5ed6119e7b5941e8.swift @@ -0,0 +1,4 @@ +// {"signature":"swift::constraints::TrailingClosureRequiresExplicitLabel::fixIt(swift::InFlightDiagnostic&, swift::constraints::FunctionArgApplyInfo const&) const"} +// RUN: not --crash %target-swift-frontend -typecheck %s +a {} +func a(repeat each b, c) diff --git a/validation-test/compiler_crashers_2/5f942981131dbcab.swift b/validation-test/compiler_crashers_2/5f942981131dbcab.swift new file mode 100644 index 0000000000000..7cf787904813d --- /dev/null +++ b/validation-test/compiler_crashers_2/5f942981131dbcab.swift @@ -0,0 +1,3 @@ +// {"signature":"matchCallArguments(swift::constraints::ConstraintSystem&, swift::FunctionType*, swift::ArgumentList*, llvm::ArrayRef, llvm::ArrayRef, swift::constraints::ConstraintKind, swift::constraints::ConstraintLocatorBuilder, std::__1::optional, llvm::SmallVectorImpl>&)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +func a< b, c >(b, d : KeyPath< b, c >b ) a ((e, at: f\g diff --git a/validation-test/compiler_crashers_2/624dafcf406667e8.swift b/validation-test/compiler_crashers_2/624dafcf406667e8.swift new file mode 100644 index 0000000000000..3f24a29f92e73 --- /dev/null +++ b/validation-test/compiler_crashers_2/624dafcf406667e8.swift @@ -0,0 +1,5 @@ +// {"signature":"(anonymous namespace)::SyntacticElementSolutionApplication::visitReturnStmt(swift::ReturnStmt*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +enum a func b(c : a) { +let: + ()->Copyable = { c return diff --git a/validation-test/compiler_crashers_2/72eed0e8ff21c1a.swift b/validation-test/compiler_crashers_2/72eed0e8ff21c1a.swift new file mode 100644 index 0000000000000..e3cc8d658608b --- /dev/null +++ b/validation-test/compiler_crashers_2/72eed0e8ff21c1a.swift @@ -0,0 +1,5 @@ +// {"signature":"swift::InFlightDiagnostic swift::diagnoseAttrWithRemovalFixIt&, swift::AccessorDecl const*&>(swift::Decl const*, swift::DeclAttribute const*, swift::Diag&, swift::AccessorDecl const*&)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +// REQUIRES: objc_interop +class a open extension a { + @objc b(_) diff --git a/validation-test/compiler_crashers_2/7375195b753c3ca3.swift b/validation-test/compiler_crashers_2/7375195b753c3ca3.swift new file mode 100644 index 0000000000000..9104113d8a9c3 --- /dev/null +++ b/validation-test/compiler_crashers_2/7375195b753c3ca3.swift @@ -0,0 +1,3 @@ +// {"signature":"fixRequirementFailure(swift::constraints::ConstraintSystem&, swift::Type, swift::Type, swift::ASTNode, llvm::ArrayRef)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +class a func b< each c : a >(repeat each c) b( d repeat { diff --git a/validation-test/compiler_crashers_2/76b298dbdff34f1.swift b/validation-test/compiler_crashers_2/76b298dbdff34f1.swift new file mode 100644 index 0000000000000..ac2ad656d543a --- /dev/null +++ b/validation-test/compiler_crashers_2/76b298dbdff34f1.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::TypeBase::getContextSubstitutions(swift::DeclContext const*, swift::GenericEnvironment*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +@propertyWrapper struct a < b { wrappedValue : c var projectedValue init(projectedValue d) func e(@a & f g : b diff --git a/validation-test/compiler_crashers_2/84cb3a91833322c6.swift b/validation-test/compiler_crashers_2/84cb3a91833322c6.swift new file mode 100644 index 0000000000000..d26132d63fe84 --- /dev/null +++ b/validation-test/compiler_crashers_2/84cb3a91833322c6.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::constraints::OutOfOrderArgumentFailure::diagnoseAsError()"} +// RUN: not --crash %target-swift-frontend -typecheck %s +func a(b : Int c : Int) a ((c: 1 b: 2 diff --git a/validation-test/compiler_crashers_2/8b3bbe2fe5878590.swift b/validation-test/compiler_crashers_2/8b3bbe2fe5878590.swift new file mode 100644 index 0000000000000..8213a58df79f3 --- /dev/null +++ b/validation-test/compiler_crashers_2/8b3bbe2fe5878590.swift @@ -0,0 +1,10 @@ +// {"signature":"swift::TypeBase::getContextSubstitutions(swift::DeclContext const*, swift::GenericEnvironment*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +struct a< b { + @propertyWrapper struct c { + var wrappedValue + projectedValue : a + init(projectedValue + a) { + func d(@c b) d($e + : f diff --git a/validation-test/compiler_crashers_2/8d73bb4170a0c447.swift b/validation-test/compiler_crashers_2/8d73bb4170a0c447.swift new file mode 100644 index 0000000000000..82ef75dbeb65d --- /dev/null +++ b/validation-test/compiler_crashers_2/8d73bb4170a0c447.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::ParamDecl::setTypeCheckedDefaultExpr(swift::Expr*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +func a(b= a( diff --git a/validation-test/compiler_crashers_2/93b241538559442a.swift b/validation-test/compiler_crashers_2/93b241538559442a.swift new file mode 100644 index 0000000000000..d780a2f82f213 --- /dev/null +++ b/validation-test/compiler_crashers_2/93b241538559442a.swift @@ -0,0 +1,5 @@ +// {"signature":"swift::ASTWalker::PostWalkResult (anonymous namespace)::Verifier::dispatchVisitPost(swift::MakeTemporarilyEscapableExpr*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +func a(b: () -> Void, c: (() -> Void?) -> Void) { + withoutActuallyEscaping(b, do : c) + } diff --git a/validation-test/compiler_crashers_2/9ae5dcaffa1a80.swift b/validation-test/compiler_crashers_2/9ae5dcaffa1a80.swift new file mode 100644 index 0000000000000..51ce39bd172be --- /dev/null +++ b/validation-test/compiler_crashers_2/9ae5dcaffa1a80.swift @@ -0,0 +1,6 @@ +// {"signature":"void (anonymous namespace)::StmtChecker::checkSiblingCaseStmts(swift::CaseStmt* const*, swift::CaseStmt* const*, swift::CaseParentKind, bool&, swift::Type)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +enum a func b(c : a) -> Int { + switch + c { + case (let \d)d diff --git a/validation-test/compiler_crashers_2/9c465a4c5d33b28c.swift b/validation-test/compiler_crashers_2/9c465a4c5d33b28c.swift new file mode 100644 index 0000000000000..8decce7a9cddb --- /dev/null +++ b/validation-test/compiler_crashers_2/9c465a4c5d33b28c.swift @@ -0,0 +1,3 @@ +// {"signature":"void llvm::function_ref::callback_fn, swift::rewriting::PropertyMap const&)::$_0::operator()(swift::GenericTypeParamType*) const::'lambda'(auto&)>(long, llvm::raw_ostream&)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +struct a&, llvm::ArrayRef)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +@available(*, unavailable) @available(_PackageDescription 3) func a { + @available(_PackageDescription 5) func b diff --git a/validation-test/compiler_crashers_2/b2548f4cd9bcd52d.swift b/validation-test/compiler_crashers_2/b2548f4cd9bcd52d.swift new file mode 100644 index 0000000000000..9f8901dc42fdc --- /dev/null +++ b/validation-test/compiler_crashers_2/b2548f4cd9bcd52d.swift @@ -0,0 +1,4 @@ +// {"signature":"isEscaping(swift::Type)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +func a->String{ b} + func b(c : (sending String diff --git a/validation-test/compiler_crashers_2/b33dbab8ed3643.swift b/validation-test/compiler_crashers_2/b33dbab8ed3643.swift new file mode 100644 index 0000000000000..1c4debe625482 --- /dev/null +++ b/validation-test/compiler_crashers_2/b33dbab8ed3643.swift @@ -0,0 +1,7 @@ +// {"signature":"swift::TypeBase::computeCanonicalType()"} +// RUN: env DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib not --crash %target-swift-frontend -typecheck %s +// REQUIRES: OS=macosx +// REQUIRES: target-same-as-host +// REQUIRES: no_asan +func a (Int -> Int = { $0 func b( () = {}? ) func b { + / 1 diff --git a/validation-test/compiler_crashers_2/bf67776f769fa0f1.swift b/validation-test/compiler_crashers_2/bf67776f769fa0f1.swift new file mode 100644 index 0000000000000..5b56ac46938b0 --- /dev/null +++ b/validation-test/compiler_crashers_2/bf67776f769fa0f1.swift @@ -0,0 +1,5 @@ +// {"signature":"(anonymous namespace)::TypeResolver::resolveType(swift::TypeRepr*, swift::TypeResolutionOptions)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +// REQUIRES: objc_interop +class a open extension a { + @objc b : _ diff --git a/validation-test/compiler_crashers_2/c3b37ed583f2402b.swift b/validation-test/compiler_crashers_2/c3b37ed583f2402b.swift new file mode 100644 index 0000000000000..96973c6c1980c --- /dev/null +++ b/validation-test/compiler_crashers_2/c3b37ed583f2402b.swift @@ -0,0 +1,5 @@ +// {"signature":"swift::TypeTransform<(anonymous namespace)::MapTypeIntoContext>::doIt(swift::Type, swift::TypePosition)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +class a < b protocol + c{associatedtype f : a associatedtype d : a} func e < b : c { + b.f = b.d diff --git a/validation-test/compiler_crashers_2/c8563a4a60b27cf3.swift b/validation-test/compiler_crashers_2/c8563a4a60b27cf3.swift new file mode 100644 index 0000000000000..355fe39c86922 --- /dev/null +++ b/validation-test/compiler_crashers_2/c8563a4a60b27cf3.swift @@ -0,0 +1,7 @@ +// {"signature":"swift::CanTypeVisitor&, llvm::SmallVectorImpl&, llvm::SmallVectorImpl&)::Matcher>::MatchVisitor, bool, swift::Type, swift::Type>::visit(swift::CanType, swift::Type, swift::Type)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +protocol a { + associatedtype b associatedtype c associatedtype d func e(b, c) -> d +} +struct f < j, g : a where h == g.c struct i : a { + e(j, _) extension f where g == i diff --git a/validation-test/compiler_crashers_2/ca37c33bbdab835.swift b/validation-test/compiler_crashers_2/ca37c33bbdab835.swift new file mode 100644 index 0000000000000..2d6c461b61837 --- /dev/null +++ b/validation-test/compiler_crashers_2/ca37c33bbdab835.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::constraints::NonEphemeralConversionFailure::emitSuggestionNotes() const"} +// RUN: not --crash %target-swift-frontend -typecheck %s +func a(@_nonEphemeral UnsafePointer?? ) var b = "" a(b diff --git a/validation-test/compiler_crashers_2/cec5966bff434957.swift b/validation-test/compiler_crashers_2/cec5966bff434957.swift new file mode 100644 index 0000000000000..ae34ef3b825b5 --- /dev/null +++ b/validation-test/compiler_crashers_2/cec5966bff434957.swift @@ -0,0 +1,4 @@ +// {"signature":"swift::getAssociatedTypeOfDistributedSystemOfActor(swift::DeclContext*, swift::Identifier)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +// REQUIRES: OS=macosx +import Distributed distributed var a{{ diff --git a/validation-test/compiler_crashers_2/dc31b2ef4315855a.swift b/validation-test/compiler_crashers_2/dc31b2ef4315855a.swift new file mode 100644 index 0000000000000..7e3694b6eb558 --- /dev/null +++ b/validation-test/compiler_crashers_2/dc31b2ef4315855a.swift @@ -0,0 +1,5 @@ +// {"signature":"swift::rewriting::RewriteSystem::verifyMinimizedRules(llvm::DenseSet> const&) const"} +// RUN: not --crash %target-swift-frontend -typecheck %s +protocol a: Collection where Element == b!{ associatedtype b: c } + protocol d { associatedtype e where e == Self.b.e associatedtype f: a where f.Element == e } + protocol c { associatedtype e: g associatedtype h: i where h.b == Self protocol i: d protocol g { associatedtype b: c where b.e == Self diff --git a/validation-test/compiler_crashers_2/e6a483a39992886f.swift b/validation-test/compiler_crashers_2/e6a483a39992886f.swift new file mode 100644 index 0000000000000..9c7b1af44f8a7 --- /dev/null +++ b/validation-test/compiler_crashers_2/e6a483a39992886f.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::BuiltinTupleDecl::getTupleSelfType(swift::ExtensionDecl const*) const"} +// RUN: not --crash %target-swift-frontend -typecheck %s +typealias a = () extension a diff --git a/validation-test/compiler_crashers_2/e714818ef0d04b52.swift b/validation-test/compiler_crashers_2/e714818ef0d04b52.swift new file mode 100644 index 0000000000000..9cfd8df285da6 --- /dev/null +++ b/validation-test/compiler_crashers_2/e714818ef0d04b52.swift @@ -0,0 +1,4 @@ +// {"signature":"(anonymous namespace)::AssociatedTypeInference::findSolutionsRec(llvm::ArrayRef, llvm::SmallVectorImpl<(anonymous namespace)::InferredTypeWitnessesSolution>&, llvm::SmallVectorImpl<(anonymous namespace)::InferredTypeWitnessesSolution>&, llvm::SmallVector, 4u>&, unsigned int, unsigned int, unsigned int)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +class a : b protocol b { + typealias c typealias c : = c diff --git a/validation-test/compiler_crashers_2/eb61865acc77c50.swift b/validation-test/compiler_crashers_2/eb61865acc77c50.swift new file mode 100644 index 0000000000000..7867d63211a81 --- /dev/null +++ b/validation-test/compiler_crashers_2/eb61865acc77c50.swift @@ -0,0 +1,3 @@ +// {"signature":"(anonymous namespace)::SyntacticElementConstraintGenerator::visitBraceStmt(swift::BraceStmt*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +[ switch { case (let a)print( diff --git a/validation-test/compiler_crashers_2/f3ef80da3095d840.swift b/validation-test/compiler_crashers_2/f3ef80da3095d840.swift new file mode 100644 index 0000000000000..0aa5d4cf9e2d7 --- /dev/null +++ b/validation-test/compiler_crashers_2/f3ef80da3095d840.swift @@ -0,0 +1,4 @@ +// {"signature":"swift::AutoClosureExpr::getUnwrappedCurryThunkExpr() const"} +// RUN: not --crash %target-swift-frontend -typecheck %s +protocol a { associatedtype b associatedtype c where c == Dictionary func d -> c? } + let e: a e.d diff --git a/validation-test/compiler_crashers_2/f8296a9a293c6ae7.swift b/validation-test/compiler_crashers_2/f8296a9a293c6ae7.swift new file mode 100644 index 0000000000000..86194f0b89779 --- /dev/null +++ b/validation-test/compiler_crashers_2/f8296a9a293c6ae7.swift @@ -0,0 +1,5 @@ +// {"signature":"void swift::Diagnostic::gatherArgs(swift::Type)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +// REQUIRES: objc_interop +class a open extension a { + @objc b : Int & diff --git a/validation-test/compiler_crashers_2/fca26dd570bcdf1c.swift b/validation-test/compiler_crashers_2/fca26dd570bcdf1c.swift new file mode 100644 index 0000000000000..0e980b74dacb4 --- /dev/null +++ b/validation-test/compiler_crashers_2/fca26dd570bcdf1c.swift @@ -0,0 +1,5 @@ +// {"signature":"(anonymous namespace)::TypeResolver::resolveVarargType(swift::VarargTypeRepr*, swift::TypeResolutionOptions)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +// REQUIRES: objc_interop +class a open extension a { + @objc b : Int... diff --git a/validation-test/compiler_crashers_2_fixed/2e698e9f7b48e8c.swift b/validation-test/compiler_crashers_2_fixed/2e698e9f7b48e8c.swift new file mode 100644 index 0000000000000..3c4b2471c9867 --- /dev/null +++ b/validation-test/compiler_crashers_2_fixed/2e698e9f7b48e8c.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::constraints::ConstraintSystem::simplifyRestrictedConstraintImpl(swift::constraints::ConversionRestrictionKind, swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::optionset::OptionSet, swift::constraints::ConstraintLocatorBuilder)"} +// RUN: not %target-swift-frontend -typecheck %s +struct a < b struct c func d .0 c struct c < a, e diff --git a/validation-test/compiler_crashers_2_fixed/4d5c64ab845e174f.swift b/validation-test/compiler_crashers_2_fixed/4d5c64ab845e174f.swift new file mode 100644 index 0000000000000..6a221b919c073 --- /dev/null +++ b/validation-test/compiler_crashers_2_fixed/4d5c64ab845e174f.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::rewriting::RewriteSystem::computeCandidateConformancePaths(swift::rewriting::PropertyMap const&, llvm::MapVector, std::__1::allocator>>, llvm::DenseMap, llvm::detail::DenseMapPair>, llvm::SmallVector, std::__1::allocator>>>, 0u>>&) const::$_0::operator()(unsigned int) const"} +// RUN: not %target-swift-frontend -typecheck %s +protocol a { associatedtype b associatedtype c : a where c.c.c == Self, c.c.b== Self! From c3fc76fb7a4b5ddd4a057a0e82a1f70fcd3560d1 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Thu, 19 Jun 2025 09:00:46 +0100 Subject: [PATCH 3/3] [test] Add a few more known type-checker crashers --- .../compiler_crashers_2/49ab67ad3514bb58.swift | 3 +++ .../compiler_crashers_2/5367d3b1ce20b9aa.swift | 5 +++++ .../compiler_crashers_2/73082a7a311258.swift | 3 +++ .../compiler_crashers_2/b862de77602e6bcf.swift | 2 +- .../compiler_crashers_2/c8277c165c1ebfa.swift | 5 +++++ .../compiler_crashers_2/dd217e2a416bc8a.swift | 3 +++ .../compiler_crashers_2/efd413faa5b859c9.swift | 3 +++ .../compiler_crashers_2/ffc098188a1c39ca.swift | 10 ++++++++++ 8 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 validation-test/compiler_crashers_2/49ab67ad3514bb58.swift create mode 100644 validation-test/compiler_crashers_2/5367d3b1ce20b9aa.swift create mode 100644 validation-test/compiler_crashers_2/73082a7a311258.swift create mode 100644 validation-test/compiler_crashers_2/c8277c165c1ebfa.swift create mode 100644 validation-test/compiler_crashers_2/dd217e2a416bc8a.swift create mode 100644 validation-test/compiler_crashers_2/efd413faa5b859c9.swift create mode 100644 validation-test/compiler_crashers_2/ffc098188a1c39ca.swift diff --git a/validation-test/compiler_crashers_2/49ab67ad3514bb58.swift b/validation-test/compiler_crashers_2/49ab67ad3514bb58.swift new file mode 100644 index 0000000000000..01d437cdfdd2d --- /dev/null +++ b/validation-test/compiler_crashers_2/49ab67ad3514bb58.swift @@ -0,0 +1,3 @@ +// {"signature":"cloneRawLiteralExpr(swift::ASTContext&, swift::LiteralExpr*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +a enum a : Double { case = 3.7 case diff --git a/validation-test/compiler_crashers_2/5367d3b1ce20b9aa.swift b/validation-test/compiler_crashers_2/5367d3b1ce20b9aa.swift new file mode 100644 index 0000000000000..68ce6369517ab --- /dev/null +++ b/validation-test/compiler_crashers_2/5367d3b1ce20b9aa.swift @@ -0,0 +1,5 @@ +// {"signature":"swift::NominalTypeDecl::lookupConformance(swift::ProtocolDecl*, llvm::SmallVectorImpl&) const"} +// RUN: not --crash %target-swift-frontend -typecheck %s +// REQUIRES: objc_interop +@objc protocol a{a} extension a { + a class b : a diff --git a/validation-test/compiler_crashers_2/73082a7a311258.swift b/validation-test/compiler_crashers_2/73082a7a311258.swift new file mode 100644 index 0000000000000..5a56c86379424 --- /dev/null +++ b/validation-test/compiler_crashers_2/73082a7a311258.swift @@ -0,0 +1,3 @@ +// {"signature":"(anonymous namespace)::ABIDependencyEvaluator::computeABIDependenciesForModule(swift::ModuleDecl*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +class a let _ a.init = 0 diff --git a/validation-test/compiler_crashers_2/b862de77602e6bcf.swift b/validation-test/compiler_crashers_2/b862de77602e6bcf.swift index ca07e17c97a90..7a815051554fb 100644 --- a/validation-test/compiler_crashers_2/b862de77602e6bcf.swift +++ b/validation-test/compiler_crashers_2/b862de77602e6bcf.swift @@ -1,4 +1,4 @@ -// {"signature":"$s11swiftASTGen19addQueuedDiagnostic20queuedDiagnosticsPtr011perFrontende5StateH04text8severity4cLoc12categoryName17documentationPath015highlightRangesH0012numHighlightT013fixItsUntypedySv_SvSo16BridgedStringRefVSo0zE8SeverityVSo0z6SourceN0VA2NSPySo0Z15CharSourceRangeVGSgSiSo0Z8ArrayRefVtF"} +// {"signature":"$s11swiftASTGen19addQueuedDiagnostic20queuedDiagnosticsPtr011perFrontende5StateH04text8severity4cLoc12categoryName17documentationPath015highlightRangesH0012numHighlightT013fixItsUntypedySv_SvSo16BridgedStringRefVSo0A0O0E4KindVSo0z6SourceN0VA2NSPySo0Z15CharSourceRangeVGSgSiSo0Z8ArrayRefVtF"} // RUN: not --crash %target-swift-frontend -typecheck %s // REQUIRES: swift_swift_parser class a { @objc ( : ( b diff --git a/validation-test/compiler_crashers_2/c8277c165c1ebfa.swift b/validation-test/compiler_crashers_2/c8277c165c1ebfa.swift new file mode 100644 index 0000000000000..301044c3f04bd --- /dev/null +++ b/validation-test/compiler_crashers_2/c8277c165c1ebfa.swift @@ -0,0 +1,5 @@ +// {"signature":"swift::CallerSideDefaultArgExprRequest::evaluate(swift::Evaluator&, swift::DefaultArgumentExpr*) const"} +// RUN: not --crash %target-swift-frontend -typecheck %s +@expression macro a (() = +#b) +#a diff --git a/validation-test/compiler_crashers_2/dd217e2a416bc8a.swift b/validation-test/compiler_crashers_2/dd217e2a416bc8a.swift new file mode 100644 index 0000000000000..d687d6e20dd31 --- /dev/null +++ b/validation-test/compiler_crashers_2/dd217e2a416bc8a.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::rewriting::RewriteContext::getProtocolComponentRec(swift::ProtocolDecl const*, llvm::SmallVectorImpl&)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +protocol a : b protocol b : c protocol d : a class c < e : d diff --git a/validation-test/compiler_crashers_2/efd413faa5b859c9.swift b/validation-test/compiler_crashers_2/efd413faa5b859c9.swift new file mode 100644 index 0000000000000..35ca9e656e49d --- /dev/null +++ b/validation-test/compiler_crashers_2/efd413faa5b859c9.swift @@ -0,0 +1,3 @@ +// {"signature":"swift::constraints::ConstraintSystem::recordOpenedTypes(swift::constraints::ConstraintLocatorBuilder, llvm::SmallVectorImpl>&, bool)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +struct b let c = { (a : b)in switch a { case .d(... e diff --git a/validation-test/compiler_crashers_2/ffc098188a1c39ca.swift b/validation-test/compiler_crashers_2/ffc098188a1c39ca.swift new file mode 100644 index 0000000000000..4a0beae5dcaeb --- /dev/null +++ b/validation-test/compiler_crashers_2/ffc098188a1c39ca.swift @@ -0,0 +1,10 @@ +// {"signature":"createPropertyStoreOrCallSuperclassSetter(swift::AccessorDecl*, swift::Expr*, swift::AbstractStorageDecl*, (anonymous namespace)::TargetImpl, llvm::SmallVectorImpl&, swift::ASTContext&)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +@propertyWrapper struct a < b { + wrappedValue : b static subscript(_enclosingInstance d + : c, wrapped e + : ReferenceWritableKeyPath + storage f + : ReferenceWritableKeyPath) Self +} class g { + @a h = 7