Open
Description
Description
The following program attempts to get the Span
of an InlineArray
and causes a compiler crash, but ONLY when -swift-version 6
is specified in the compilation line.
Reproduction
@main
struct Application {
/// Main entry point.
static func main() {
let elements: InlineArray<4, Int> = [1, 2, 3, 4]
//let elements: [Int] = [1, 2, 3, 4] // <- this works
let span: Span<Int> = elements.span
print("Span contents: \(span[0])")
}
}
austin@GANON:~/src/swift-unix$ swiftc \
-swift-version 6 \
-sil-verify-all -parse-as-library \
-target x86_64-unknown-none-elf \
-O -wmo \
-enable-experimental-feature Embedded \
./Bug.swift -c -o bug.o
Stack dump
swift-frontend: /home/build-user/swift/lib/SILOptimizer/Analysis/RegionAnalysis.cpp:3415: TranslationSemantics swift::regionanalysisimpl::PartitionOpTranslator::visitVectorBaseAddrInst(VectorBaseAddrInst *): Assertion `(TranslationSemantics::LookThrough != TranslationSemantics::LookThrough || isStaticallyLookThroughInst(inst)) && "Out of sync?!"' failed.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /home/austin/.local/share/swiftly/toolchains/main-snapshot-2025-05-25/usr/bin/swift-frontend -frontend -c Bug.swift -target x86_64-unknown-none-elf -disable-objc-interop -color-diagnostics -Xcc -fcolor-diagnostics -swift-version 6 -O -enable-experimental-feature Embedded -empty-abi-descriptor -no-auto-bridging-header-chaining -module-name bug -sil-verify-all -in-process-plugin-server-path /home/austin/.local/share/swiftly/toolchains/main-snapshot-2025-05-25/usr/lib/swift/host/libSwiftInProcPluginServer.so -plugin-path /home/austin/.local/share/swiftly/toolchains/main-snapshot-2025-05-25/usr/lib/swift/host/plugins -plugin-path /home/austin/.local/share/swiftly/toolchains/main-snapshot-2025-05-25/usr/local/lib/swift/host/plugins -enable-default-cmo -parse-as-library -o bug.o
1. Swift version 6.2-dev (LLVM 7f9c8ab4840f392, Swift 29a9fb0ecb9da65)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for bug)
4. While running pass #33 SILFunctionTransform "SendNonSendable" on SILFunction "@$e3bug11ApplicationV4mainyyFZ".
for 'main()' (at Bug.swift:5:5)
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 0x0000598018ae1498
1 swift-frontend 0x0000598018adefbe
2 swift-frontend 0x0000598018ae1b31
3 libc.so.6 0x00007abbf4442520
4 libc.so.6 0x00007abbf44969fc pthread_kill + 300
5 libc.so.6 0x00007abbf4442476 raise + 22
6 libc.so.6 0x00007abbf44287f3 abort + 211
7 libc.so.6 0x00007abbf442871b
8 libc.so.6 0x00007abbf4439e96
9 swift-frontend 0x0000598011ba7f6b
10 swift-frontend 0x0000598011ba1a75
11 swift-frontend 0x0000598011ba04d3
12 swift-frontend 0x0000598011b996c4
13 swift-frontend 0x0000598011bc150e
14 swift-frontend 0x0000598011bc141e
15 swift-frontend 0x0000598011b9bb76
16 swift-frontend 0x0000598011b9e598
17 swift-frontend 0x0000598011de4574
18 swift-frontend 0x0000598011de1f1c
19 swift-frontend 0x0000598011866920
20 swift-frontend 0x0000598011867b71
21 swift-frontend 0x000059801186af6e
22 swift-frontend 0x0000598011864588
23 swift-frontend 0x000059801186453d
24 swift-frontend 0x000059801188782a
25 swift-frontend 0x00005980118727c6
26 swift-frontend 0x000059801186477f
27 swift-frontend 0x00005980118740d1
28 swift-frontend 0x00005980111e6478
29 swift-frontend 0x0000598010e813d7
30 swift-frontend 0x0000598010e80523
31 swift-frontend 0x0000598010e91eca
32 swift-frontend 0x0000598010e832be
33 swift-frontend 0x0000598010e82358
34 swift-frontend 0x0000598010bec3db
35 libc.so.6 0x00007abbf4429d90
36 libc.so.6 0x00007abbf4429e40 __libc_start_main + 128
37 swift-frontend 0x0000598010beb3d5
Expected behavior
An (embedded mode) object file is properly emitted.
Environment
austin@GANON:~/src/swift-unix$ swiftc -version
Swift version 6.2-dev (LLVM 7f9c8ab4840f392, Swift 29a9fb0ecb9da65)
Target: x86_64-unknown-linux-gnu
Build config: +assertions
Additional information
Additional notes:
- If
-swift-version 6
is specified, and if theInlineArray<4, Int>
is replaced with a heap allocated[Int]
, then this crash goes away. - If
-swift-version 6
is not specified, then bothInlineArray
and[Int]
work correctly.