-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
swift-frontend crashes with the code below.
Steps to reproduce
Create repro.swift with:
protocol Protocol<T> { associatedtype T }
typealias AnyProtocol<T> = any Protocol<T>
let crash: AnyProtocol<Any?>Run swiftc repro.swift -g, notice a crash.
error: compile command failed due to exception 3 (use -v to see invocation)
Incorrect reconstructed type for $s021AnyIMapStringOptionalA5Crash0A8ProtocolayypXSqGD
Original type:
(type_alias_type decl=AnyIMapStringOptionalAnyCrash.(file)[email protected]:2:11 underlying='any Protocol<Any?>'
(optional_type
(existential_type
(protocol_composition_type))))
Reconstructed type:
(type_alias_type decl=AnyIMapStringOptionalAnyCrash.(file)[email protected]:2:11 underlying='any Protocol<Any?>'
(optional_type
(protocol_composition_type)))
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Pass '-Xfrontend -disable-round-trip-debug-types' to disable this assertion.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: C:/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swift-frontend.exe -frontend -c -primary-file AnyIMapStringOptionalAnyCrash.swift -target x86_64-unknown-windows-msvc -disable-objc-interop -sdk C:\\Library\\Developer\\Platforms\\Windows.platform\\Developer\\SDKs\\Windows.sdk -color-diagnostics -g -empty-abi-descriptor -plugin-path C:\\Library\\Developer\\Toolchains\\unknown-Asserts-development.xctoolchain\\usr\\lib\\swift\\host\\plugins -plugin-path C:\\Library\\Developer\\Toolchains\\unknown-Asserts-development.xctoolchain\\usr\\local\\lib\\swift\\host\\plugins -resource-dir C:\\Library\\Developer\\Toolchains\\unknown-Asserts-development.xctoolchain\\usr\\lib\\swift -enable-anonymous-context-mangled-names -module-name AnyIMapStringOptionalAnyCrash -o C:\\Users\\micro\\AppData\\Local\\Temp\\TemporaryDirectory.pNefTf\\AnyIMapStringOptionalAnyCrash-2.o
1. compnerd.org Swift version 5.9-dev (LLVM d6e3e8530cae473, Swift c36841839184939)
2. Compiling with the current language version
3. While evaluating request IRGenRequest(IR Generation for file "AnyIMapStringOptionalAnyCrash.swift")
Exception Code: 0x80000003
#0 0x00007ff6289a1155 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x57c1155)
#1 0x00007ffe4593e5f5 (C:\Windows\System32\ucrtbase.dll+0x7e5f5)
#2 0x00007ffe4593f601 (C:\Windows\System32\ucrtbase.dll+0x7f601)
#3 0x00007ff6237d2fd1 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x5f2fd1)
#4 0x00007ff6237d56c6 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x5f56c6)
#5 0x00007ff6237cfb66 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x5efb66)
#6 0x00007ff6237cfae6 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x5efae6)
#7 0x00007ff623737418 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x557418)
#8 0x00007ff62374c3b0 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x56c3b0)
#9 0x00007ff62391eb2a (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x73eb2a)
#10 0x00007ff62373f432 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x55f432)
#11 0x00007ff6236ce9bc (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x4ee9bc)
#12 0x00007ff6236d9726 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x4f9726)
#13 0x00007ff6236c2de1 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x4e2de1)
#14 0x00007ff6236d34da (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x4f34da)
#15 0x00007ff6233e3955 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x203955)
#16 0x00007ff6233e4502 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x204502)
#17 0x00007ff6233e2d25 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x202d25)
#18 0x00007ff6233e328c (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x20328c)
#19 0x00007ff6233e5912 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x205912)
#20 0x00007ff623269c66 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x89c66)
#21 0x00007ff623269679 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x89679)
#22 0x00007ff628a2c82c (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x584c82c)
#23 0x00007ffe472426ad (C:\Windows\System32\KERNEL32.DLL+0x126ad)
#24 0x00007ffe47eea9f8 (C:\Windows\SYSTEM32\ntdll.dll+0x5a9f8)
error: fatalError
Expected behavior
The compiler should not crash. This code should compile with a warning for the unused variable.
Environment
- Swift compiler version info:
compnerd.org Swift version 5.9-dev (LLVM d6e3e8530cae473, Swift c36841839184939)
Target: x86_64-unknown-windows-msvc
(main build from 2023-06-06)
- Xcode version info: N/A
- Deployment target: Windows 11
Also repros on macOS:
Swift version 5.9-dev (LLVM 4a3b38183d7bb09, Swift 07b7d1b61cf78fb)
Target: arm64-apple-macosx13.0
smumriak and stevenbrix
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels