swift icon indicating copy to clipboard operation
swift copied to clipboard

Compiler crash with "Assertion failed: signature || !origType->hasTypeParameter()"

Open hjyamauchi opened this issue 9 months ago • 1 comments

Description

I get this crash building an internal app with a locally built toolchain on Windows from swift/main sync'd 5 days ago. I thought this is https://github.com/apple/swift/issues/73198 but its fix https://github.com/apple/swift/pull/73215 doesn't fix it. So splitting that into an new issue here.

Reproduction

None yet. It's from an internal app build.

Stack dump

error: compile command failed due to exception 3 (use -v to see invocation)
Assertion failed: signature || !origType->hasTypeParameter(), file S:\SourceCache\swift\include\swift/SIL/AbstractionPattern.h, line 529
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.      Program arguments: S:/PROGRA~1/Swift/TOOLCH~1/000611~1.0_A/usr/bin/swift-frontend.exe -frontend -c C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\BaseModel+FirebaseData.swift C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\BatchKeyValueCollector.swift C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\DocumentChangeHelpers.swift C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\EncryptedEntity+FirebaseData.swift C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\FirebaseSidebarSyncClient+Impl.swift C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\FirebaseSidebarSyncClient+Model.swift C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\FirebaseSidebarSyncClient.swift C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\FirebaseSidebarSyncTestTool.swift C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\Logger.swift C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\PublishTransaction.swift C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\SyncMode+Combine.swift C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\TimeThrottlingConfig.swift -primary-file C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\TimeThrottlingRebatcher.swift -emit-reference-dependencies-path C:\\Users\\hiroshi\\arc\\build\\debug\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\CMakeFiles\\FirebaseSidebarSyncClient.dir\\TimeThrottlingRebatcher.swift.obj.swiftdeps -target x86_64-unknown-windows-msvc -disable-objc-interop -cxx-interoperability-mode=default -sdk "S:\\Program Files\\Swift\\Platforms\\Windows.platform\\Developer\\SDKs\\Windows.sdk" -windows-sdk-version 10.0.22000.0 -I C:\\Users\\hiroshi\\arc\\build\\debug\\swift -I C:\\Users\\hiroshi\\arc\\build\\debug\\_deps\\opencombine-src\\Sources\\COpenCombineHelpers\\include -I C:\\Users\\hiroshi\\arc\\build\\debug\\_deps\\swiftfirebase-src\\Sources\\firebase\\include -I C:\\Users\\hiroshi\\arc\\build\\NugetPackages\\com.google.firebase.windows.amd64.0.0.0-f6d6ee2\\include -I C:\\Users\\hiroshi\\arc\\Frameworks\\ARCClients\\Sources\\LevelDBChecker\\Headers -I C:\\Users\\hiroshi\\arc\\build\\debug\\generated\\Frameworks\\WinRT\\Sources\\CWinRT\\include -I "S:\\Program Files\\Swift\\Toolchains\\0.0.0+Asserts\\usr\\include" -I C:\\Users\\hiroshi\\arc\\build\\NugetPackages\\org.libsodium.libsodium.windows.amd64.0.0.0-ec57a46\\include -enable-testing -module-link-name FirebaseSidebarSyncClient -static -Onone -D SWIFT_PACKAGE -D DEBUG -g -debug-info-format=dwarf -disable-round-trip-debug-types -disable-large-loadable-types-reg2mem -empty-abi-descriptor -Xcc -working-directory -Xcc C:\\Users\\hiroshi\\arc\\build\\debug -resource-dir S:\\PROGRA~1\\Swift\\TOOLCH~1\\000611~1.0_A\\usr\\lib\\swift -Xcc -DINTERNAL_EXPERIMENTAL -Xcc -DSODIUM_STATIC -Xcc -DINTERNAL_EXPERIMENTAL -Xcc -DSR69711 -module-name FirebaseSidebarSyncClient -plugin-path S:\\PROGRA~1\\Swift\\TOOLCH~1\\000611~1.0_A\\usr\\bin -plugin-path S:\\PROGRA~1\\Swift\\TOOLCH~1\\000611~1.0_A\\usr\\local\\bin -parse-as-library -num-threads 64 -o C:\\Users\\hiroshi\\arc\\build\\debug\\Frameworks\\ARCClients\\Sources\\FirebaseSidebarSyncClient\\CMakeFiles\\FirebaseSidebarSyncClient.dir\\TimeThrottlingRebatcher.swift.obj -index-store-path C:\\Users\\hiroshi\\arc\\build\\debug\\index -index-system-modules
1.      Swift version 6.0-dev (LLVM 384be736a3af7f0, Swift 3d32f5fc8a9087a)
2.      Compiling with effective version 5.10
3.      While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "C:\Users\hiroshi\arc\Frameworks\ARCClients\Sources\FirebaseSidebarSyncClient\TimeThrottlingRebatcher.swift")
4.      While silgen emitFunction SIL function "@$s25FirebaseSidebarSyncClient23TimeThrottlingRebatcherC13planNextEvent33_511274859BA13DF783665B0F348B6BACLL2inySd_tF".
 for 'planNextEvent(in:)' (at C:\Users\hiroshi\arc\Frameworks\ARCClients\Sources\FirebaseSidebarSyncClient\TimeThrottlingRebatcher.swift:119:13)
Exception Code: 0x80000003
 #0 0x00007ff7a5e07485 HandleAbort (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x73a7485)
 #1 0x00007ff9a5f4e695 (C:\WINDOWS\System32\ucrtbase.dll+0x7e695)
 #2 0x00007ff9a5f4f6a1 (C:\WINDOWS\System32\ucrtbase.dll+0x7f6a1)
 #3 0x00007ff9a5f5104e (C:\WINDOWS\System32\ucrtbase.dll+0x8104e)
 #4 0x00007ff9a5f51291 (C:\WINDOWS\System32\ucrtbase.dll+0x81291)
 #5 0x00007ff79f387e29 swift::Lowering::AbstractionPattern::initSwiftType(class swift::SubstitutionMap, class swift::CanGenericSignature, class swift::CanType, enum swift::Lowering::AbstractionPattern::Kind) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x927e29)
 #6 0x00007ff7a022c3f5 swift::SILFunctionConventions::isTypedError(void) const (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x17cc3f5)
 #7 0x00007ff7a0224f0e swift::SILResultInfo::getReturnValueType(class swift::SILModule &, class swift::SILFunctionType const *, class swift::TypeExpansionContext) const (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x17c4f0e)
 #8 0x00007ff7a0211748 clang::QualType::operator->(void) const (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x17b1748)
 #9 0x00007ff7a0222f42 swift::Lowering::TypeConverter::getNSStringType(void) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x17c2f42)
#10 0x00007ff7a022750a swift::SILFunction::getTypeExpansionContext(void) const (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x17c750a)
#11 0x00007ff7a021d063 swift::Lowering::TypeConverter::getConstantInfo(class swift::TypeExpansionContext, struct swift::SILDeclRef) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x17bd063)
#12 0x00007ff79f775b7f BoxInitialization::finishInitialization(class swift::Lowering::SILGenFunction &) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xd15b7f)
#13 0x00007ff79f776b0b BoxInitialization::getAddressForInPlaceInitialization(class swift::Lowering::SILGenFunction &, class swift::SILLocation) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xd16b0b)
#14 0x00007ff79f771cd4 swift::Lowering::SILGenFunction::emitSetAccessor(class swift::SILLocation, struct swift::SILDeclRef, class swift::SubstitutionMap, class swift::Lowering::ArgumentSource &&, bool, bool, class swift::Lowering::PreparedArguments &&, class swift::Lowering::ArgumentSource &&, bool) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xd11cd4)
#15 0x00007ff79f76b211 swift::Lowering::SILGenFunction::emitGetAccessor(class swift::SILLocation, struct swift::SILDeclRef, class swift::SubstitutionMap, class swift::Lowering::ArgumentSource &&, bool, bool, class swift::Lowering::PreparedArguments &&, class swift::Lowering::SGFContext, bool, class std::optional<class swift::ActorIsolation>) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xd0b211)
#16 0x00007ff79f73d8d4 swift::Lowering::LValue::forValue(enum swift::Lowering::SGFAccessKind, class swift::Lowering::ManagedValue, class swift::CanType) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xcdd8d4)
#17 0x00007ff79f7357ce swift::Lowering::SILGenFunction::emitLoadOfLValue(class swift::SILLocation, class swift::Lowering::LValue &&, class swift::Lowering::SGFContext, bool) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xcd57ce)
#18 0x00007ff79f736d49 swift::Lowering::SILGenFunction::emitRValueForNonMemberVarDecl(class swift::SILLocation, class swift::ConcreteDeclRef, class swift::CanType, enum swift::AccessSemantics, class swift::Lowering::SGFContext) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xcd6d49)
#19 0x00007ff79f698393 swift::Lowering::SILGenFunction::emitRValueForDecl(class swift::SILLocation, class swift::ConcreteDeclRef, class swift::Type, enum swift::AccessSemantics, class swift::Lowering::SGFContext) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xc38393)
#20 0x00007ff79f6a2f49 llvm::SmallVectorTemplateBase<class swift::Lowering::RValue, 0>::takeAllocationForGrow(class swift::Lowering::RValue *, unsigned __int64) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xc42f49)
#21 0x00007ff79f698179 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(class swift::Expr *, class swift::Lowering::SGFContext) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xc38179)
#22 0x00007ff79f76bbb8 swift::Lowering::SILGenFunction::emitGetAccessor(class swift::SILLocation, struct swift::SILDeclRef, class swift::SubstitutionMap, class swift::Lowering::ArgumentSource &&, bool, bool, class swift::Lowering::PreparedArguments &&, class swift::Lowering::SGFContext, bool, class std::optional<class swift::ActorIsolation>) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xd0bbb8)
#23 0x00007ff79f75c0cb llvm::CastInfo<class swift::OptionalEvaluationExpr, class swift::Expr *, void>::doCastIfPossible(class swift::Expr *const &) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xcfc0cb)
#24 0x00007ff79f76e7e3 swift::Lowering::SILGenFunction::emitMonomorphicApply(class swift::SILLocation, class swift::Lowering::ManagedValue, class llvm::ArrayRef<class swift::Lowering::ManagedValue>, class swift::CanType, class swift::CanType, class swift::optionset::OptionSet<enum swift::ApplyFlags, unsigned char>, class std::optional<enum swift::SILFunctionTypeRepresentation>, class std::optional<class swift::ForeignErrorConvention> const &, class swift::Lowering::SGFContext) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xd0e7e3)
#25 0x00007ff79f75c2df llvm::CastInfo<class swift::OptionalEvaluationExpr, class swift::Expr *, void>::doCastIfPossible(class swift::Expr *const &) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xcfc2df)
#26 0x00007ff79f762149 swift::Lowering::SILGenFunction::emitApplyWithRethrow(class swift::SILLocation, class swift::SILValue, class swift::SILType, class swift::SubstitutionMap, class llvm::ArrayRef<class swift::SILValue>) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xd02149)
#27 0x00007ff79f755fcd swift::Lowering::PreparedArguments::add(class swift::SILLocation, class swift::Lowering::RValue &&) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xcf5fcd)
#28 0x00007ff79f7547e9 swift::Lowering::PreparedArguments::add(class swift::SILLocation, class swift::Lowering::RValue &&) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xcf47e9)
#29 0x00007ff79f75f970 swift::Lowering::SILGenFunction::emitApplyExpr(class swift::ApplyExpr *, class swift::Lowering::SGFContext) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xcff970)
#30 0x00007ff79f6a3c9f llvm::SmallVectorTemplateBase<class swift::Lowering::RValue, 0>::takeAllocationForGrow(class swift::Lowering::RValue *, unsigned __int64) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xc43c9f)
#31 0x00007ff79f6980d1 swift::Lowering::SILGenFunction::emitRValue(class swift::Expr *, class swift::Lowering::SGFContext) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xc380d1)
#32 0x00007ff79f69262f swift::Lowering::SILGenFunction::emitIgnoredExpr(class swift::Expr *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xc3262f)
#33 0x00007ff79f716484 swift::Lowering::SILGenFunction::prepareIndirectResultInit(class swift::SILLocation, class swift::Lowering::AbstractionPattern, class swift::CanType, class llvm::SmallVectorImpl<class swift::SILValue> &, class llvm::SmallVectorImpl<class swift::DiverseStackBase::stable_iterator> &) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xcb6484)
#34 0x00007ff79f71541f swift::Lowering::SILGenFunction::prepareIndirectResultInit(class swift::SILLocation, class swift::Lowering::AbstractionPattern, class swift::CanType, class llvm::SmallVectorImpl<class swift::SILValue> &, class llvm::SmallVectorImpl<class swift::DiverseStackBase::stable_iterator> &) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xcb541f)
#35 0x00007ff79f712813 swift::Lowering::SILGenFunction::emitStmt(class swift::Stmt *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xcb2813)
#36 0x00007ff79f6bfab6 swift::Lowering::SILGenFunction::emitFunction(class swift::FuncDecl *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xc5fab6)
#37 0x00007ff79f62233b swift::Lowering::SILGenModule::emitFunctionDefinition(struct swift::SILDeclRef, class swift::SILFunction *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xbc233b)
#38 0x00007ff79f6254c9 swift::Lowering::SILGenModule::emitOrDelayFunction(struct swift::SILDeclRef) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xbc54c9)
#39 0x00007ff79f621575 swift::Lowering::SILGenModule::emitFunction(class swift::FuncDecl *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xbc1575)
#40 0x00007ff79f672338 SILGenExtension::visitFuncDecl(class swift::FuncDecl *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xc12338)
#41 0x00007ff79f66c6dd swift::Lowering::SILGenModule::emitSelfConformanceWitnessTable(class swift::ProtocolDecl *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xc0c6dd)
#42 0x00007ff79f672758 swift::Lowering::SILGenModule::visitNominalTypeDecl(class swift::NominalTypeDecl *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xc12758)
#43 0x00007ff79f625767 swift::Lowering::SILGenModule::emitPropertyWrapperBackingInitializer(class swift::VarDecl *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xbc5767)
#44 0x00007ff79f625ef4 swift::ASTLoweringRequest::evaluate(class swift::Evaluator &, struct swift::ASTLoweringDescriptor) const (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xbc5ef4)
#45 0x00007ff79f630bd6 swift::SimpleRequest<class swift::ASTLoweringRequest, (struct swift::ASTLoweringDescriptor), 9>::evaluateRequest(class swift::ASTLoweringRequest const &, class swift::Evaluator &) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xbd0bd6)
#46 0x00007ff79f61b632 swift::Evaluator::getResultUncached<class swift::ASTLoweringRequest, class `class std::unique_ptr<class swift::SILModule, struct std::default_delete<class swift::SILModule>> __cdecl swift::evaluateOrFatal<class swift::ASTLoweringRequest>(class swift::Evaluator &, class swift::ASTLoweringRequest)'::`2'::<lambda_1>>(class swift::ASTLoweringRequest const &, class `class std::unique_ptr<class swift::SILModule, struct std::default_delete<class swift::SILModule>> __cdecl swift::evaluateOrFatal<class swift::ASTLoweringRequest>(class swift::Evaluator &, class swift::ASTLoweringRequest)'::`2'::<lambda_1>) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xbbb632)
#47 0x00007ff79f62f1f1 swift::performASTLowering(class swift::FileUnit &, class swift::Lowering::TypeConverter &, class swift::SILOptions const &, class swift::IRGenOptions const *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0xbcf1f1)
#48 0x00007ff79edf146c swift::performCompileStepsPostSema(class swift::CompilerInstance &, int &, class swift::FrontendObserver *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x39146c)
#49 0x00007ff79edefd08 std::basic_stringbuf<char, struct std::char_traits<char>, class std::allocator<char>>::pbackfail(int) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x38fd08)
#50 0x00007ff79edf027e std::basic_stringbuf<char, struct std::char_traits<char>, class std::allocator<char>>::pbackfail(int) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x39027e)
#51 0x00007ff79edf27db swift::performFrontend(class llvm::ArrayRef<char const *>, char const *, void *, class swift::FrontendObserver *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x3927db)
#52 0x00007ff79ec30b3b llvm::SmallVectorTemplateBase<char const *, 1>::push_back(char const *) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x1d0b3b)
#53 0x00007ff79ec306dc swift::mainEntry(int, char const **) (S:\PROGRA~1\Swift\TOOLCH~1\000611~1.0_A\usr\bin\swift-frontend.exe+0x1d06dc)
#54 0x00007ff7a5e7e148 invoke_main D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78:0
#55 0x00007ff7a5e7e148 __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
#56 0x00007ff9a6c1257d (C:\WINDOWS\System32\KERNEL32.DLL+0x1257d)
#57 0x00007ff9a8c0aa48 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x5aa48)
ninja: build stopped: subcommand failed.

Expected behavior

No crash

Environment

Windows

Additional information

No response

hjyamauchi avatar Apr 30 '24 18:04 hjyamauchi

I bisected this issue to https://github.com/apple/swift/commit/3e637b0afb9db1158e3c0e1fe9b6434893a929a5 which is https://github.com/apple/swift/pull/73129.

If I rebuild the toolchain at that commit, this crash happens and at the previous commit https://github.com/apple/swift/commit/7ef1701f6f7e60d34953b8794e77bab35bac3d77, it does not.

This is still broken at head and our internal Windows toolchain release is blocked.

@slavapestov Do you have any thoughts?

CC @compnerd

hjyamauchi avatar May 03 '24 00:05 hjyamauchi

CC @hborla

hjyamauchi avatar May 07 '24 20:05 hjyamauchi

I was able to reproduce the crash on macOS with a program that's is publicly-accessible:

Repro.swift

import Foundation
import Dependencies
import OpenCombineSchedulers

public actor TimeThrottlingRebatcher<SourceBatchId: Hashable, Key: Hashable, Value> {
      private func planNextEvent() {
          @Dependency(\.mainQueue) var mainQueue
          mainQueue.schedule(after: .init(mainQueue.now.dispatchTime)) { }
      }
}

Package.swift

// swift-tools-version: 5.9
import PackageDescription
let package = Package(
  name: "Repro",
  platforms: [
    .iOS(.v13),
    .macOS(.v10_15),
    .tvOS(.v13),
    .watchOS(.v6),
  ],
  dependencies: [
    .package(
       url: "https://github.com/pointfreeco/swift-dependencies",
       branch: "main"
    ),
    .package(
      url: "https://github.com/thebrowsercompany/open-combine-schedulers",
      branch: "main"
    ),
  ],
        
  targets: [
    .target(
      name: "Repro",
      dependencies: [
        .product(name: "Dependencies", package: "swift-dependencies"),
        .product(name: "OpenCombineSchedulers", package: "open-combine-schedulers"),
      ]
    )
  ]
)

It doesn't crash with

  • swift 5.9 (swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1) Target: arm64-apple-macosx14.0)
  • swift-DEVELOPMENT-SNAPSHOT-2024-04-13-a

but crashes with

  • swift-DEVELOPMENT-SNAPSHOT-2024-04-21-a
  • swift-DEVELOPMENT-SNAPSHOT-2024-05-01-a (the latest snapshot).

as follows.

hiroshi@himbp Repro % cat Sources/Repro/Repro.swift 
import Foundation
import Dependencies
import OpenCombineSchedulers

public actor TimeThrottlingRebatcher<SourceBatchId: Hashable, Key: Hashable, Value> {
      private func planNextEvent() {
          @Dependency(\.mainQueue) var mainQueue
          mainQueue.schedule(after: .init(mainQueue.now.dispatchTime)) { }
      }
}
hiroshi@himbp Repro % cat Package.swift 
// swift-tools-version: 5.9
import PackageDescription
let package = Package(
  name: "Repro",
  platforms: [
    .iOS(.v13),
    .macOS(.v10_15),
    .tvOS(.v13),
    .watchOS(.v6),
  ],
  dependencies: [
    .package(
       url: "https://github.com/pointfreeco/swift-dependencies",
       branch: "main"
    ),
    .package(
      url: "https://github.com/thebrowsercompany/open-combine-schedulers",
      branch: "main"
    ),
  ],
        
  targets: [
    .target(
      name: "Repro",
      dependencies: [
        .product(name: "Dependencies", package: "swift-dependencies"),
        .product(name: "OpenCombineSchedulers", package: "open-combine-schedulers"),
      ]
    )
  ]
)
hiroshi@himbp Repro % rm -rf .build 
hiroshi@himbp Repro % /usr/bin/swift build
Fetching https://github.com/pointfreeco/swift-dependencies from cache
Fetched https://github.com/pointfreeco/swift-dependencies (0.44s)
Fetching https://github.com/thebrowsercompany/open-combine-schedulers from cache
Fetched https://github.com/thebrowsercompany/open-combine-schedulers (0.39s)
Fetching https://github.com/OpenCombine/OpenCombine.git from cache
Fetching https://github.com/pointfreeco/xctest-dynamic-overlay from cache
Fetching https://github.com/pointfreeco/swift-concurrency-extras from cache
Fetched https://github.com/OpenCombine/OpenCombine.git (0.43s)
Fetched https://github.com/pointfreeco/swift-concurrency-extras (0.43s)
Fetching https://github.com/pointfreeco/combine-schedulers from cache
Fetching https://github.com/pointfreeco/swift-clocks from cache
Fetched https://github.com/pointfreeco/xctest-dynamic-overlay (0.44s)
Fetching https://github.com/apple/swift-syntax from cache
Fetched https://github.com/pointfreeco/combine-schedulers (0.42s)
Fetched https://github.com/pointfreeco/swift-clocks (0.42s)
Fetched https://github.com/apple/swift-syntax (0.64s)
Computing version for https://github.com/OpenCombine/OpenCombine.git
Computed https://github.com/OpenCombine/OpenCombine.git at 0.14.0 (0.02s)
Computing version for https://github.com/pointfreeco/combine-schedulers
Computed https://github.com/pointfreeco/combine-schedulers at 1.0.0 (0.02s)
Computing version for https://github.com/pointfreeco/xctest-dynamic-overlay
Computed https://github.com/pointfreeco/xctest-dynamic-overlay at 1.1.2 (0.01s)
Computing version for https://github.com/pointfreeco/swift-concurrency-extras
Computed https://github.com/pointfreeco/swift-concurrency-extras at 1.1.0 (0.01s)
Computing version for https://github.com/pointfreeco/swift-clocks
Computed https://github.com/pointfreeco/swift-clocks at 1.0.2 (0.01s)
Computing version for https://github.com/apple/swift-syntax
Computed https://github.com/apple/swift-syntax at 510.0.2 (0.02s)
Creating working copy for https://github.com/pointfreeco/swift-clocks
Working copy of https://github.com/pointfreeco/swift-clocks resolved at 1.0.2
Creating working copy for https://github.com/apple/swift-syntax
Working copy of https://github.com/apple/swift-syntax resolved at 510.0.2
Creating working copy for https://github.com/pointfreeco/swift-dependencies
Working copy of https://github.com/pointfreeco/swift-dependencies resolved at main
Creating working copy for https://github.com/OpenCombine/OpenCombine.git
Working copy of https://github.com/OpenCombine/OpenCombine.git resolved at 0.14.0
Creating working copy for https://github.com/thebrowsercompany/open-combine-schedulers
Working copy of https://github.com/thebrowsercompany/open-combine-schedulers resolved at main
Creating working copy for https://github.com/pointfreeco/swift-concurrency-extras
Working copy of https://github.com/pointfreeco/swift-concurrency-extras resolved at 1.1.0
Creating working copy for https://github.com/pointfreeco/combine-schedulers
Working copy of https://github.com/pointfreeco/combine-schedulers resolved at 1.0.0
Creating working copy for https://github.com/pointfreeco/xctest-dynamic-overlay
Working copy of https://github.com/pointfreeco/xctest-dynamic-overlay resolved at 1.1.2
Building for debugging...
[205/205] Compiling Repro Repro.swift
Build complete! (19.13s)
hiroshi@himbp Repro % ~/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-04-13-a.xctoolchain/usr/bin/swift build
Building for debugging...
[217/217] Emitting module Repro
Build complete! (25.11s)
hiroshi@himbp Repro % ~/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-04-21-a.xctoolchain/usr/bin/swift build
Building for debugging...
error: compile command failed due to signal 6 (use -v to see invocation)
Assertion failed: (signature || !origType->hasTypeParameter()), function initSwiftType, file AbstractionPattern.h, line 529.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.	Program arguments: /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-04-21-a.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/hiroshi/dev/devin-1352/Repro/Sources/Repro/Repro.swift -emit-dependencies-path /Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/Repro.build/Repro.d -emit-reference-dependencies-path /Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/Repro.build/Repro.swiftdeps -target arm64-apple-macosx10.15 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -I /Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/Modules -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -external-plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-plugin-server -empty-abi-descriptor -Xcc -working-directory -Xcc /Users/hiroshi/dev/devin-1352/Repro -resource-dir /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-04-21-a.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /Users/hiroshi/dev/devin-1352/Repro -Xcc -fmodule-map-file=/Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/COpenCombineHelpers.build/module.modulemap -Xcc -I -Xcc /Users/hiroshi/dev/devin-1352/Repro/.build/checkouts/OpenCombine/Sources/COpenCombineHelpers/include -Xcc -isysroot -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -Xcc -g -module-name Repro -package-name repro -target-sdk-version 14.0 -target-sdk-name macosx14.0 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-04-21-a.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-04-21-a.xctoolchain/usr/local/lib/swift/host/plugins -parse-as-library -o /Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/Repro.build/Repro.swift.o -index-store-path /Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/index/store -index-system-modules
1.	Apple Swift version 6.0-dev (LLVM b3d7c45a25a792f, Swift 81534a6c151c6ed)
2.	Compiling with effective version 5.10
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/Users/hiroshi/dev/devin-1352/Repro/Sources/Repro/Repro.swift")
4.	While silgen emitFunction SIL function "@$s5Repro23TimeThrottlingRebatcherC13planNextEvent33_671EBBCD0F02F33421B2F5D9CAAF5895LLyyF".
 for 'planNextEvent()' (at /Users/hiroshi/dev/devin-1352/Repro/Sources/Repro/Repro.swift:6:15)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x000000010a409f60 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x000000010a40872c llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x000000010a40a5a8 SignalHandler(int) + 304
3  libsystem_platform.dylib 0x000000018cacb584 _sigtramp + 56
4  libsystem_pthread.dylib  0x000000018ca9ac20 pthread_kill + 288
5  libsystem_c.dylib        0x000000018c9a7a20 abort + 180
6  libsystem_c.dylib        0x000000018c9a6d10 err + 0
7  swift-frontend           0x000000010a48f8ec void llvm::function_ref<void (swift::irgen::IRGenFunction&)>::callback_fn<getAllocateBoxedOpaqueExistentialBufferFunction(swift::irgen::IRGenModule&, (anonymous namespace)::OpaqueExistentialLayout)::$_4>(long, swift::irgen::IRGenFunction&) (.cold.1) + 0
8  swift-frontend           0x00000001053e8f14 void llvm::function_ref<void (swift::irgen::IRGenFunction&)>::callback_fn<getAllocateBoxedOpaqueExistentialBufferFunction(swift::irgen::IRGenModule&, (anonymous namespace)::OpaqueExistentialLayout)::$_4>(long, swift::irgen::IRGenFunction&) + 0
9  swift-frontend           0x0000000105dec038 getSILFunctionType(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::SILExtInfoBuilder, (anonymous namespace)::Conventions const&, swift::ForeignInfo const&, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SubstitutionMap>, swift::ProtocolConformanceRef) + 3664
10 swift-frontend           0x0000000105de3578 getNativeSILFunctionType(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::SILExtInfoBuilder, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SubstitutionMap>, swift::ProtocolConformanceRef) + 768
11 swift-frontend           0x0000000105de63a8 getUncachedSILFunctionTypeForConstant(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::SILDeclRef, swift::Lowering::TypeConverter::LoweredFormalTypes) + 1136
12 swift-frontend           0x0000000105de6e24 swift::Lowering::TypeConverter::getConstantInfo(swift::TypeExpansionContext, swift::SILDeclRef) + 216
13 swift-frontend           0x00000001055d9e00 (anonymous namespace)::Callee::forDirect(swift::Lowering::SILGenFunction&, swift::SILDeclRef, swift::SubstitutionMap, swift::SILLocation, bool) + 136
14 swift-frontend           0x00000001055dee6c emitSpecializedAccessorFunctionRef(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::SILDeclRef, swift::SubstitutionMap, swift::Lowering::ArgumentSource&, bool, bool, bool) + 760
15 swift-frontend           0x00000001055de8a0 swift::Lowering::SILGenFunction::emitGetAccessor(swift::SILLocation, swift::SILDeclRef, swift::SubstitutionMap, swift::Lowering::ArgumentSource&&, bool, bool, swift::Lowering::PreparedArguments&&, swift::Lowering::SGFContext, bool, std::__1::optional<swift::ActorIsolation>) + 176
16 swift-frontend           0x00000001056709a0 (anonymous namespace)::GetterSetterComponent::get(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::SGFContext) && + 300
17 swift-frontend           0x0000000105663704 swift::Lowering::SILGenFunction::emitLoadOfLValue(swift::SILLocation, swift::Lowering::LValue&&, swift::Lowering::SGFContext, bool) + 612
18 swift-frontend           0x0000000105662ad0 swift::Lowering::SILGenFunction::emitRValueForNonMemberVarDecl(swift::SILLocation, swift::ConcreteDeclRef, swift::CanType, swift::AccessSemantics, swift::Lowering::SGFContext) + 620
19 swift-frontend           0x000000010563cbc8 (anonymous namespace)::RValueEmitter::visitDeclRefExpr(swift::DeclRefExpr*, swift::Lowering::SGFContext) + 80
20 swift-frontend           0x00000001056313b4 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 56
21 swift-frontend           0x00000001055e41fc (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 3640
22 swift-frontend           0x00000001055d545c (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 312
23 swift-frontend           0x00000001055e28e8 (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 192
24 swift-frontend           0x00000001055ed99c (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, swift::ForeignInfo const&) && + 532
25 swift-frontend           0x00000001055ed29c (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, swift::ForeignInfo const&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, std::__1::optional<swift::SILLocation>&) + 840
26 swift-frontend           0x00000001055d8dec (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 1800
27 swift-frontend           0x00000001055d7480 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2028
28 swift-frontend           0x000000010563198c swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 912
29 swift-frontend           0x00000001056b3208 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 4352
30 swift-frontend           0x00000001056b20fc swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 24
31 swift-frontend           0x00000001056535d4 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 432
32 swift-frontend           0x00000001055c5768 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 6324
33 swift-frontend           0x00000001055c6578 swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) + 252
34 swift-frontend           0x00000001055c3e7c swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 196
35 swift-frontend           0x00000001056c6d00 (anonymous namespace)::SILGenType::visitFuncDecl(swift::FuncDecl*) + 28
36 swift-frontend           0x00000001056c3c00 (anonymous namespace)::SILGenType::emitType() + 276
37 swift-frontend           0x00000001056c3ae0 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 24
38 swift-frontend           0x00000001055c8e90 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 880
39 swift-frontend           0x00000001056b1b54 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 148
40 swift-frontend           0x00000001055ce784 swift::ASTLoweringRequest::OutputType swift::Evaluator::getResultUncached<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) + 340
41 swift-frontend           0x00000001055c9794 swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 96
42 swift-frontend           0x0000000104fb4474 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 568
43 swift-frontend           0x0000000104fc5714 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160
44 swift-frontend           0x0000000104fb6ab0 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 708
45 swift-frontend           0x0000000104fb5a1c swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2368
46 swift-frontend           0x0000000104dd10e8 swift::mainEntry(int, char const**) + 3096
47 dyld                     0x000000018c7120e0 start + 2360

hiroshi@himbp Repro % ~/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-05-01-a.xctoolchain/usr/bin/swift build
Building for debugging...
error: compile command failed due to signal 6 (use -v to see invocation)
Assertion failed: (signature || !origType->hasTypeParameter()), function initSwiftType, file AbstractionPattern.h, line 529.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.	Program arguments: /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-05-01-a.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/hiroshi/dev/devin-1352/Repro/Sources/Repro/Repro.swift -emit-dependencies-path /Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/Repro.build/Repro.d -emit-reference-dependencies-path /Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/Repro.build/Repro.swiftdeps -target arm64-apple-macosx10.15 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -I /Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/Modules -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -external-plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-plugin-server -empty-abi-descriptor -Xcc -working-directory -Xcc /Users/hiroshi/dev/devin-1352/Repro -resource-dir /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-05-01-a.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /Users/hiroshi/dev/devin-1352/Repro -Xcc -fmodule-map-file=/Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/COpenCombineHelpers.build/module.modulemap -Xcc -I -Xcc /Users/hiroshi/dev/devin-1352/Repro/.build/checkouts/OpenCombine/Sources/COpenCombineHelpers/include -Xcc -isysroot -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -Xcc -g -module-name Repro -package-name repro -target-sdk-version 14.0 -target-sdk-name macosx14.0 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-05-01-a.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-05-01-a.xctoolchain/usr/local/lib/swift/host/plugins -parse-as-library -o /Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/Repro.build/Repro.swift.o -index-store-path /Users/hiroshi/dev/devin-1352/Repro/.build/arm64-apple-macosx/debug/index/store -index-system-modules
1.	Apple Swift version 6.0-dev (LLVM b66077aefd3be08, Swift 84d36181a762913)
2.	Compiling with effective version 5.10
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/Users/hiroshi/dev/devin-1352/Repro/Sources/Repro/Repro.swift")
4.	While silgen emitFunction SIL function "@$s5Repro23TimeThrottlingRebatcherC13planNextEvent33_671EBBCD0F02F33421B2F5D9CAAF5895LLyyF".
 for 'planNextEvent()' (at /Users/hiroshi/dev/devin-1352/Repro/Sources/Repro/Repro.swift:6:15)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x0000000109d6d600 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000109d6bdcc llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000109d6dc48 SignalHandler(int) + 304
3  libsystem_platform.dylib 0x000000018cacb584 _sigtramp + 56
4  libsystem_pthread.dylib  0x000000018ca9ac20 pthread_kill + 288
5  libsystem_c.dylib        0x000000018c9a7a20 abort + 180
6  libsystem_c.dylib        0x000000018c9a6d10 err + 0
7  swift-frontend           0x0000000109df2ed8 void llvm::function_ref<void (swift::irgen::IRGenFunction&)>::callback_fn<getAllocateBoxedOpaqueExistentialBufferFunction(swift::irgen::IRGenModule&, (anonymous namespace)::OpaqueExistentialLayout)::$_4>(long, swift::irgen::IRGenFunction&) (.cold.1) + 0
8  swift-frontend           0x0000000104d3cf3c void llvm::function_ref<void (swift::irgen::IRGenFunction&)>::callback_fn<getAllocateBoxedOpaqueExistentialBufferFunction(swift::irgen::IRGenModule&, (anonymous namespace)::OpaqueExistentialLayout)::$_4>(long, swift::irgen::IRGenFunction&) + 0
9  swift-frontend           0x0000000105743508 getSILFunctionType(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::SILExtInfoBuilder, (anonymous namespace)::Conventions const&, swift::ForeignInfo const&, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SubstitutionMap>, swift::ProtocolConformanceRef) + 3652
10 swift-frontend           0x000000010573a86c getNativeSILFunctionType(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::SILExtInfoBuilder, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SubstitutionMap>, swift::ProtocolConformanceRef) + 684
11 swift-frontend           0x000000010573d51c getUncachedSILFunctionTypeForConstant(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::SILDeclRef, swift::Lowering::TypeConverter::LoweredFormalTypes) + 1260
12 swift-frontend           0x000000010573e0a4 swift::Lowering::TypeConverter::getConstantInfo(swift::TypeExpansionContext, swift::SILDeclRef) + 216
13 swift-frontend           0x0000000104f2f3b8 (anonymous namespace)::Callee::forDirect(swift::Lowering::SILGenFunction&, swift::SILDeclRef, swift::SubstitutionMap, swift::SILLocation, bool) + 136
14 swift-frontend           0x0000000104f34424 emitSpecializedAccessorFunctionRef(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::SILDeclRef, swift::SubstitutionMap, swift::Lowering::ArgumentSource&, bool, bool, bool) + 760
15 swift-frontend           0x0000000104f33e58 swift::Lowering::SILGenFunction::emitGetAccessor(swift::SILLocation, swift::SILDeclRef, swift::SubstitutionMap, swift::Lowering::ArgumentSource&&, bool, bool, swift::Lowering::PreparedArguments&&, swift::Lowering::SGFContext, bool, std::__1::optional<swift::ActorIsolation>) + 176
16 swift-frontend           0x0000000104fc5f48 (anonymous namespace)::GetterSetterComponent::get(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::SGFContext) && + 300
17 swift-frontend           0x0000000104fb8cac swift::Lowering::SILGenFunction::emitLoadOfLValue(swift::SILLocation, swift::Lowering::LValue&&, swift::Lowering::SGFContext, bool) + 612
18 swift-frontend           0x0000000104fb8078 swift::Lowering::SILGenFunction::emitRValueForNonMemberVarDecl(swift::SILLocation, swift::ConcreteDeclRef, swift::CanType, swift::AccessSemantics, swift::Lowering::SGFContext) + 620
19 swift-frontend           0x0000000104f9216c (anonymous namespace)::RValueEmitter::visitDeclRefExpr(swift::DeclRefExpr*, swift::Lowering::SGFContext) + 80
20 swift-frontend           0x0000000104f86958 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 56
21 swift-frontend           0x0000000104f397b4 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 3640
22 swift-frontend           0x0000000104f2aa14 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 312
23 swift-frontend           0x0000000104f37ea0 (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 192
24 swift-frontend           0x0000000104f42f54 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, swift::ForeignInfo const&) && + 532
25 swift-frontend           0x0000000104f42854 (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, swift::ForeignInfo const&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, std::__1::optional<swift::SILLocation>&) + 840
26 swift-frontend           0x0000000104f2e3a4 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 1800
27 swift-frontend           0x0000000104f2ca38 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2028
28 swift-frontend           0x0000000104f86f30 swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 912
29 swift-frontend           0x0000000105008580 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 4352
30 swift-frontend           0x0000000105007474 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 24
31 swift-frontend           0x0000000104fa8b7c swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 432
32 swift-frontend           0x0000000104f1ad10 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 6324
33 swift-frontend           0x0000000104f1bb30 swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) + 252
34 swift-frontend           0x0000000104f19424 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 196
35 swift-frontend           0x000000010501c070 (anonymous namespace)::SILGenType::visitFuncDecl(swift::FuncDecl*) + 28
36 swift-frontend           0x0000000105018f70 (anonymous namespace)::SILGenType::emitType() + 276
37 swift-frontend           0x0000000105018e50 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 24
38 swift-frontend           0x0000000104f1e448 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 880
39 swift-frontend           0x0000000105006ecc swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 148
40 swift-frontend           0x0000000104f23d3c swift::ASTLoweringRequest::OutputType swift::Evaluator::getResultUncached<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) + 340
41 swift-frontend           0x0000000104f1ed4c swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 96
42 swift-frontend           0x000000010490822c swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 568
43 swift-frontend           0x00000001049194cc withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160
44 swift-frontend           0x000000010490a868 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 708
45 swift-frontend           0x00000001049097d4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2368
46 swift-frontend           0x00000001047249cc swift::mainEntry(int, char const**) + 3096
47 dyld                     0x000000018c7120e0 start + 2360

hiroshi@himbp Repro % 

CC @slavapestov @hborla @compnerd

hjyamauchi avatar May 09 '24 23:05 hjyamauchi

Here's a small, self-contained reproducer that crashes on macOS.

I hope this is helpful. CC @slavapestov @hborla @compnerd

import Combine
import Foundation

public struct AnyScheduler<SchedulerTimeType, SchedulerOptions>: Scheduler
where
  SchedulerTimeType: Strideable,
  SchedulerTimeType.Stride: SchedulerTimeIntervalConvertible
{
  public var minimumTolerance: SchedulerTimeType.Stride { fatalError() }
  public var now: SchedulerTimeType { fatalError() }
  public func schedule(after date: SchedulerTimeType, tolerance: SchedulerTimeType.Stride,
    options: SchedulerOptions?, _ action: @escaping () -> Void) {}
  public func schedule(after date: SchedulerTimeType, interval: SchedulerTimeType.Stride,
    tolerance: SchedulerTimeType.Stride, options: SchedulerOptions?,
    _ action: @escaping () -> Void) -> Cancellable { fatalError() }
  public func schedule(options: SchedulerOptions?, _ action: @escaping () -> Void) {}
}

public struct DependencyValues {
  public var mainQueue: AnyScheduler<DispatchQueue.SchedulerTimeType, DispatchQueue.SchedulerOptions> {
    get { fatalError() }
  }
}

@propertyWrapper
public struct Dependency<Value> {
  public init(_ keyPath: KeyPath<DependencyValues, Value>) {}
  public var wrappedValue: Value {
    fatalError()
  }
}

public actor Repro<K> {
  private func planNextEvent() {
    @Dependency(\.mainQueue) var mainQueue
    mainQueue.schedule(after: .init(mainQueue.now.dispatchTime)) { }
  }
}
hiroshi@himbp Repro % /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-05-01-a.xctoolchain/usr/bin/swiftc Repro.swift -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk
error: compile command failed due to signal 6 (use -v to see invocation)
Assertion failed: (signature || !origType->hasTypeParameter()), function initSwiftType, file AbstractionPattern.h, line 529.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.	Program arguments: /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-05-01-a.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/hiroshi/dev/devin-1352/Repro/Sources/Repro/Repro.swift -target arm64-apple-macosx14.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -color-diagnostics -empty-abi-descriptor -Xcc -working-directory -Xcc /Users/hiroshi/dev/devin-1352/Repro/Sources/Repro -resource-dir /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-05-01-a.xctoolchain/usr/lib/swift -module-name Repro -target-sdk-version 14.0 -target-sdk-name macosx14.0 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-05-01-a.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Users/hiroshi/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-05-01-a.xctoolchain/usr/local/lib/swift/host/plugins -o /var/folders/ww/kxcj3hm12kd92gcwr9t3y7k40000gq/T/TemporaryDirectory.bSeawA/Repro-1.o
1.	Apple Swift version 6.0-dev (LLVM b66077aefd3be08, Swift 84d36181a762913)
2.	Compiling with effective version 5.10
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/Users/hiroshi/dev/devin-1352/Repro/Sources/Repro/Repro.swift")
4.	While silgen emitFunction SIL function "@$s5ReproAAC13planNextEvent33_671EBBCD0F02F33421B2F5D9CAAF5895LLyyF".
 for 'planNextEvent()' (at /Users/hiroshi/dev/devin-1352/Repro/Sources/Repro/Repro.swift:34:11)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x00000001064f1600 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x00000001064efdcc llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x00000001064f1c48 SignalHandler(int) + 304
3  libsystem_platform.dylib 0x000000018cacb584 _sigtramp + 56
4  libsystem_pthread.dylib  0x000000018ca9ac20 pthread_kill + 288
5  libsystem_c.dylib        0x000000018c9a7a20 abort + 180
6  libsystem_c.dylib        0x000000018c9a6d10 err + 0
7  swift-frontend           0x0000000106576ed8 void llvm::function_ref<void (swift::irgen::IRGenFunction&)>::callback_fn<getAllocateBoxedOpaqueExistentialBufferFunction(swift::irgen::IRGenModule&, (anonymous namespace)::OpaqueExistentialLayout)::$_4>(long, swift::irgen::IRGenFunction&) (.cold.1) + 0
8  swift-frontend           0x00000001014c0f3c void llvm::function_ref<void (swift::irgen::IRGenFunction&)>::callback_fn<getAllocateBoxedOpaqueExistentialBufferFunction(swift::irgen::IRGenModule&, (anonymous namespace)::OpaqueExistentialLayout)::$_4>(long, swift::irgen::IRGenFunction&) + 0
9  swift-frontend           0x0000000101ec7508 getSILFunctionType(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::SILExtInfoBuilder, (anonymous namespace)::Conventions const&, swift::ForeignInfo const&, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SubstitutionMap>, swift::ProtocolConformanceRef) + 3652
10 swift-frontend           0x0000000101ebe86c getNativeSILFunctionType(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::SILExtInfoBuilder, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SubstitutionMap>, swift::ProtocolConformanceRef) + 684
11 swift-frontend           0x0000000101ec151c getUncachedSILFunctionTypeForConstant(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::SILDeclRef, swift::Lowering::TypeConverter::LoweredFormalTypes) + 1260
12 swift-frontend           0x0000000101ec20a4 swift::Lowering::TypeConverter::getConstantInfo(swift::TypeExpansionContext, swift::SILDeclRef) + 216
13 swift-frontend           0x00000001016b33b8 (anonymous namespace)::Callee::forDirect(swift::Lowering::SILGenFunction&, swift::SILDeclRef, swift::SubstitutionMap, swift::SILLocation, bool) + 136
14 swift-frontend           0x00000001016b8424 emitSpecializedAccessorFunctionRef(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::SILDeclRef, swift::SubstitutionMap, swift::Lowering::ArgumentSource&, bool, bool, bool) + 760
15 swift-frontend           0x00000001016b7e58 swift::Lowering::SILGenFunction::emitGetAccessor(swift::SILLocation, swift::SILDeclRef, swift::SubstitutionMap, swift::Lowering::ArgumentSource&&, bool, bool, swift::Lowering::PreparedArguments&&, swift::Lowering::SGFContext, bool, std::__1::optional<swift::ActorIsolation>) + 176
16 swift-frontend           0x0000000101749f48 (anonymous namespace)::GetterSetterComponent::get(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::SGFContext) && + 300
17 swift-frontend           0x000000010173ccac swift::Lowering::SILGenFunction::emitLoadOfLValue(swift::SILLocation, swift::Lowering::LValue&&, swift::Lowering::SGFContext, bool) + 612
18 swift-frontend           0x000000010173c078 swift::Lowering::SILGenFunction::emitRValueForNonMemberVarDecl(swift::SILLocation, swift::ConcreteDeclRef, swift::CanType, swift::AccessSemantics, swift::Lowering::SGFContext) + 620
19 swift-frontend           0x000000010171616c (anonymous namespace)::RValueEmitter::visitDeclRefExpr(swift::DeclRefExpr*, swift::Lowering::SGFContext) + 80
20 swift-frontend           0x000000010170a958 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 56
21 swift-frontend           0x00000001016bd7b4 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 3640
22 swift-frontend           0x00000001016aea14 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 312
23 swift-frontend           0x00000001016bbea0 (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 192
24 swift-frontend           0x00000001016c6f54 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, swift::ForeignInfo const&) && + 532
25 swift-frontend           0x00000001016c6854 (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, swift::ForeignInfo const&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, std::__1::optional<swift::SILLocation>&) + 840
26 swift-frontend           0x00000001016b23a4 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 1800
27 swift-frontend           0x00000001016b0a38 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2028
28 swift-frontend           0x000000010170af30 swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 912
29 swift-frontend           0x000000010178c580 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 4352
30 swift-frontend           0x000000010178b474 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 24
31 swift-frontend           0x000000010172cb7c swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 432
32 swift-frontend           0x000000010169ed10 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 6324
33 swift-frontend           0x000000010169fb30 swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) + 252
34 swift-frontend           0x000000010169d424 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 196
35 swift-frontend           0x00000001017a0070 (anonymous namespace)::SILGenType::visitFuncDecl(swift::FuncDecl*) + 28
36 swift-frontend           0x000000010179cf70 (anonymous namespace)::SILGenType::emitType() + 276
37 swift-frontend           0x000000010179ce50 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 24
38 swift-frontend           0x00000001016a2448 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 880
39 swift-frontend           0x000000010178aecc swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 148
40 swift-frontend           0x00000001016a7d3c swift::ASTLoweringRequest::OutputType swift::Evaluator::getResultUncached<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) + 340
41 swift-frontend           0x00000001016a2d4c swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 96
42 swift-frontend           0x000000010108c22c swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 568
43 swift-frontend           0x000000010109d4cc withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160
44 swift-frontend           0x000000010108e868 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 708
45 swift-frontend           0x000000010108d7d4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2368
46 swift-frontend           0x0000000100ea89cc swift::mainEntry(int, char const**) + 3096
47 dyld                     0x000000018c7120e0 start + 2360

hjyamauchi avatar May 10 '24 22:05 hjyamauchi

Two corrections/clarifications

  • The above self-contained reproducer in https://github.com/apple/swift/issues/73345#issuecomment-2105325350 needed a correction for it to compile successfully when it doesn't crash: the second schedule method's action parameter needed fatalError() in its body. Updated in place.

  • For the compiler to build successfully at commit https://github.com/apple/swift/commit/3e637b0afb9db1158e3c0e1fe9b6434893a929a5 or the previous commit https://github.com/apple/swift/commit/7ef1701f6f7e60d34953b8794e77bab35bac3d77, the swift-syntax repo needs to be at commit https://github.com/apple/swift-syntax/commit/39b4c4108375ad242a4e48d49e8ddcc837b7d52c

CC @slavapestov thanks for looking into this

hjyamauchi avatar May 16 '24 22:05 hjyamauchi

Here is an even smaller reproducer

actor GenericActor<K> {
  var i: Int = 0
  private func outerFunc() {
    func accessSelf() -> Int {
      return 0
    }
    print(accessSelf())
  }
}

This seems to be an issue when the isolation parameter is of generic type. https://github.com/apple/swift/pull/73830 appears to fix the issue.

CC @hyp @slavapestov @hborla @compnerd

hjyamauchi avatar May 23 '24 00:05 hjyamauchi

@slavapestov Thanks!

hjyamauchi avatar May 23 '24 18:05 hjyamauchi