Skip to content

[SR-15254] Trunk snapshot compiler for linux x86_64 crashes with "Invalid type parameter in getCanonicalTypeInContext()" when compiling the swift-algorithms package #57576

Closed
@finagolfin

Description

@finagolfin
Previous ID SR-15254
Radar rdar://problem/84827656
Original Reporter @buttaface
Type Bug
Status Resolved
Resolution Done
Environment

Fedora Core 33 x86_64

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @jckarter
Priority Medium

md5: 450612a3e0018954fb5fa001b9d1443e

is duplicated by:

  • SR-15437 Compiler Crash when swift-alorithms is a Package Dependency

Issue Description:

The following command with the latest official trunk snapshot build ~/swift-DEVELOPMENT-SNAPSHOT-2021-09-27-a-centos8/usr/bin/swift build crashes the compiler with this long output:

error: emit-module command failed due to signal 6 (use -v to see invocation)
Invalid type parameter in getCanonicalTypeInContext()
Original type: Optional<τ_0_1.Element.Index>
Simplified term: τ_0_1.[Collection:Element].[Collection:Index]
Longest valid prefix: τ_0_1.[Collection:Element]
Prefix type: τ_0_1.Element

Requirement machine for <τ_0_0, τ_0_1 where τ_0_1 : Collection>
Rewrite system:
Unknown macro: { - [Collection].Element => [Collection}
Homotopy generators:
Unknown macro: { - [Collection].[Sequence}
Property map:
Unknown macro: { [Collection] => { conforms_to}
[Collection:Index] =>
Unknown macro: { conforms_to}
[Collection:Indices] =>
Unknown macro: { conforms_to}
[Collection:SubSequence] =>
Unknown macro: { conforms_to}
[Comparable] =>
Unknown macro: { conforms_to}
[Sequence:Iterator] =>
Unknown macro: { conforms_to}
τ_0_1 =>
Unknown macro: { conforms_to}
[Collection:Iterator] =>
Unknown macro: { conforms_to}
}

Conformance access paths:
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /home/butta/swift-DEVELOPMENT-SNAPSHOT-2021-09-27-a-centos8/usr/bin/swift-frontend -frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types /home/butta/src/swift-algorithms/Sources/Algorithms/AdjacentPairs.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Chain.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Chunked.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Combinations.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Compacted.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Cycle.swift /home/butta/src/swift-algorithms/Sources/Algorithms/EitherSequence.swift /home/butta/src/swift-algorithms/Sources/Algorithms/FirstNonNil.swift /home/butta/src/swift-algorithms/Sources/Algorithms/FlattenCollection.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Indexed.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Intersperse.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Joined.swift /home/butta/src/swift-algorithms/Sources/Algorithms/MinMax.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Partition.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Permutations.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Product.swift /home/butta/src/swift-algorithms/Sources/Algorithms/RandomSample.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Reductions.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Rotate.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Split.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Stride.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Suffix.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Trim.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Unique.swift /home/butta/src/swift-algorithms/Sources/Algorithms/Windows.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /home/butta/src/swift-algorithms/.build/x86_64-unknown-linux-gnu/debug -enable-testing -g -module-cache-path /home/butta/src/swift-algorithms/.build/x86_64-unknown-linux-gnu/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -new-driver-path /home/butta/swift-DEVELOPMENT-SNAPSHOT-2021-09-27-a-centos8/usr/bin/swift-driver -resource-dir /home/butta/swift-DEVELOPMENT-SNAPSHOT-2021-09-27-a-centos8/usr/lib/swift -enable-anonymous-context-mangled-names -Xcc -fmodule-map-file=/home/butta/src/swift-numerics/Sources/_NumericsShims/include/module.modulemap -Xcc -I -Xcc /home/butta/src/swift-numerics/Sources/_NumericsShims/include -module-name Algorithms -emit-module-doc-path /home/butta/src/swift-algorithms/.build/x86_64-unknown-linux-gnu/debug/Algorithms.swiftdoc -emit-module-source-info-path /home/butta/src/swift-algorithms/.build/x86_64-unknown-linux-gnu/debug/Algorithms.swiftsourceinfo -parse-as-library -o /home/butta/src/swift-algorithms/.build/x86_64-unknown-linux-gnu/debug/Algorithms.swiftmodule -emit-abi-descriptor-path /home/butta/src/swift-algorithms/.build/x86_64-unknown-linux-gnu/debug/Algorithms.abi.json

  1. Swift version 5.6-dev (LLVM ae102eaadf2d38c, Swift e7342eb)
  2. Compiling with the current language version
  3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for module Algorithms)
  4. While silgen emitFunction SIL function "@$s10Algorithms17FlattenCollectionV13offsetForward_2by9limitedByAC5IndexVyx_GSgAI_SiAItF".
    for 'offsetForward(_:by:limitedBy:)' (at /home/butta/src/swift-algorithms/Sources/Algorithms/FlattenCollection.swift:157:12)
    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):
    It appears to have started crashing with the Sep. 25 snapshot, as everything works with the Sep. 24 snapshot. I first saw this on my Android CI, where I had to disable cross-compiling with the trunk snapshots because of this crasher.

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions