Open
Description
Description
The following code is causing a compiler crash, with the error message:
/home/build-user/swift/lib/SILGen/SILGenApply.cpp:3464: void (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments &&, swift::Lowering::AbstractionPattern): Assertion `args.isValid()' failed.
Reproduction
struct S {
subscript<each T>(_ i: repeat each T) -> Void { return }
}
S()[1, 2]
Stack dump
swift-frontend: /home/build-user/swift/lib/SILGen/SILGenApply.cpp:3464: void (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments &&, swift::Lowering::AbstractionPattern): Assertion `args.isValid()' failed.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/swift-nightly/usr/bin/swift-frontend -frontend -S -primary-file <source> -target x86_64-unknown-linux-gnu -disable-objc-interop -g -debug-info-format=dwarf -dwarf-version=4 -empty-abi-descriptor -Xcc -working-directory -Xcc /app -resource-dir /opt/compiler-explorer/swift-nightly/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /app -Xllvm --x86-asm-syntax=intel -module-name output -in-process-plugin-server-path /opt/compiler-explorer/swift-nightly/usr/lib/swift/host/libSwiftInProcPluginServer.so -plugin-path /opt/compiler-explorer/swift-nightly/usr/lib/swift/host/plugins -plugin-path /opt/compiler-explorer/swift-nightly/usr/local/lib/swift/host/plugins -o /app/output.s
1. Swift version 6.0-dev (LLVM 609505edf5cdf90, Swift cee13f8a9c0381a)
2. Compiling with effective version 5.10
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "<source>")
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 0x00005c4ac4b54af7
1 swift-frontend 0x00005c4ac4b527fe
2 swift-frontend 0x00005c4ac4b5516f
3 libc.so.6 0x00007d7435442520
4 libc.so.6 0x00007d74354969fc pthread_kill + 300
5 libc.so.6 0x00007d7435442476 raise + 22
6 libc.so.6 0x00007d74354287f3 abort + 211
7 libc.so.6 0x00007d743542871b
8 libc.so.6 0x00007d7435439e96
9 swift-frontend 0x00005c4abe5a05a3
10 swift-frontend 0x00005c4abe59a13f
11 swift-frontend 0x00005c4abe599a80
12 swift-frontend 0x00005c4abe66e353
13 swift-frontend 0x00005c4abe668168
14 swift-frontend 0x00005c4abe667e7f
15 swift-frontend 0x00005c4abe624231
16 swift-frontend 0x00005c4abe61f89f
17 swift-frontend 0x00005c4abe613fc1
18 swift-frontend 0x00005c4abe6ed692
19 swift-frontend 0x00005c4abe6eb34b
20 swift-frontend 0x00005c4abe6ea6d9
21 swift-frontend 0x00005c4abe6eccc8
22 swift-frontend 0x00005c4abe56e489
23 swift-frontend 0x00005c4abe6c5424
24 swift-frontend 0x00005c4abe573e55
25 swift-frontend 0x00005c4abe56f36c
26 swift-frontend 0x00005c4abddaeb3f
27 swift-frontend 0x00005c4abddbfd89
28 swift-frontend 0x00005c4abddb1f11
29 swift-frontend 0x00005c4abddb0c31
30 swift-frontend 0x00005c4abdba0a94
31 libc.so.6 0x00007d7435429d90
32 libc.so.6 0x00007d7435429e40 __libc_start_main + 128
33 swift-frontend 0x00005c4abdb9fb2e
*** Signal 11: Backtracing from 0x7d7435428898... done ***
*** Program crashed: Bad pointer dereference at 0x0000000000000000 ***
Thread 0 "swift-frontend" crashed:
0 0x00007d7435428898 <unknown> in libc.so.6
Registers:
rax 0x0000000000000000 0
rdx 0x00007d7435a81880 80 18 a8 35 74 7d 00 00 a0 22 a8 35 74 7d 00 00 ··¨5t}·· "¨5t}··
rcx 0x00007d74354969fc 41 89 c5 41 f7 dd 3d 00 f0 ff ff b8 00 00 00 00 A·ÅA÷Ý=·ðÿÿ¸····
rbx 0x0000000000000006 6
rsi 0x0000000000000001 1
rdi 0x0000000000000001 1
rbp 0x00007d743561be90 01 00 00 00 01 00 00 00 80 18 a8 35 74 7d 00 00 ··········¨5t}··
rsp 0x00007ffceac81950 20 00 00 00 00 00 00 00 a0 b6 61 35 74 7d 00 00 ······· ¶a5t}··
r8 0x0000000000000000 0
r9 0x0000000000000000 0
r10 0x0000000000000008 8
r11 0x0000000000000246 582
r12 0x00005c4ac5dcaa5f 2f 68 6f 6d 65 2f 62 75 69 6c 64 2d 75 73 65 72 /home/build-user
r13 0x0000000000000d88 3464
r14 0x00005c4ac68b0eb7 61 72 67 73 2e 69 73 56 61 6c 69 64 28 29 00 54 args.isValid()·T
r15 0x00007ffceac81d78 00 00 00 00 00 00 00 00 00 00 5d ca 4a 5c 00 00 ··········]ÊJ\··
rip 0x00007d7435428898 f4 83 3d 00 36 1f 00 05 75 14 c7 05 f4 35 1f 00 ô·=·6···u·Ç·ô5··
rflags 0x0000000000010246 ZF PF
cs 0x0033 fs 0x0000 gs 0x0000
Images (27 omitted):
0x00007d7435400000–0x00007d74355bc341 490fef8403240c91833978d494d39e537409b92e libc.so.6 /lib/x86_64-linux-gnu/libc.so.6
Backtrace took 0.00s
Program terminated with signal: SIGSEGV
Compiler returned: 139
Expected behavior
The compiler shouldn't crash.
Environment
Swift version 6.0-dev (LLVM 609505edf5cdf90
, Swift cee13f8a9c0381a
)
Target: x86_64-unknown-linux-gnu
Additional information
No response
Metadata
Metadata
Assignees
Labels
Area → compiler: The SIL generation stageA deviation from expected or documented behavior. Also: expected but undesirable behavior.The Swift compiler itselfBug: A crash, i.e., an abnormal termination of softwareFeature: expressionsFeature: generic declarations and typesFeature → generics: Parameter packsFeature: Subscript declarations