i’ve been running swift applications on Amazon Linux 2023 EC2 instances for a while now. our current setup uses a 5.9.2 toolchain, and i install it like this:
curl https://download.swift.org/swift-5.9.2-release/amazonlinux2/swift-5.9.2-RELEASE/swift-5.9.2-RELEASE-amazonlinux2.tar.gz -o toolchain.tar.gz
tar -xf toolchain.tar.gz
sudo mv swift-5.9.2-RELEASE-amazonlinux2/usr/lib/* /usr/lib/
sudo mv swift-5.9.2-RELEASE-amazonlinux2/usr/libexec/* /usr/libexec/
i’ve gotten surprisingly far with this setup, but i have more than a few misgivings about it, and i cannot escape the feeling that this is unsustainable. i have a few reasons for this:
i am installing a runtime that was compiled for a different OS (Amazon Linux 2) than the OS i am actually using.
due to the much older Glibc version associated with the Amazon Linux 2 toolchain, it is not really tenable to continue developing locally with this toolchain, as VSCode devcontainers no longer support Amazon Linux 2 .
i don’t really have a solid procedure for upgrading this runtime, as i am installing it in a completely ad-hoc manner. right now i just hope that overwriting the files in /usr/lib
is sufficient.
the 5.9 toolchain itself is deeply flawed - the compiler crashes frequently, it miscompiles code that segfaults randomly at runtime , its concurrency checking is reportedly incomplete , and key libraries have already dropped support for it. therefore i have reached the conclusion that switching to a 5.10 toolchain is the only path forward. but because swift lacks ABI stability on linux, it would be difficult to keep the runtime version in sync with the compiler version, as the 5.10 toolchain changes continuously.
what is the recommended way to use swift on the server in 2024?
1 Like
perhaps it should have been obvious in foresight, but the 5.10 compiler is even more unreliable than the 5.9 compiler. one could hardly blame it for crashing or miscompiling code, as 5.10 is experimental and makes no claim of being production-ready, so i did not think it was worthwhile to continue exploring this direction.
so: it would appear that getting 5.9.2 to work on Amazon Linux 2023 is the only path forward. but despite expending countless hours trying to build the toolchain from source, i could not compile a basic project with the custom built toolchains, as i must have built it incorrectly which causes SIL verification to fail somehow. (more on that here .)
investigating why SILModuleTransform "MandatoryInlining"
is hitting assertions that the official toolchain does not is an interesting tangent, but unfortunately it is not reasonable for us to spend the rest of Q1 2024 debugging the swift compiler.
the blocking issue here is that the official swift docker images are no longer compatible with VSCode, because VSCode has bumped its Glibc requirement. are there any (realistic) options for those of us who wish to continue using swift on the server, without holding back VSCode from updating indefinitely?
1 Like
taylorswift:
the 5.10 compiler is even more unreliable than the 5.9 compiler. one could hardly blame it for crashing or miscompiling code, as 5.10 is experimental and makes no claim of being production-ready, so i did not think it was worthwhile to continue exploring this direction.
5.10 is getting close to release next month, so any remaining issues should be filed and looked at.
taylorswift:
the official swift docker images are no longer compatible with VSCode, because VSCode has bumped its Glibc requirement. are there any (realistic) options for those of us who wish to continue using swift on the server, without holding back VSCode from updating indefinitely?
Building the 5.9.2 or 5.10 toolchain from source, now with assertions disabled to avoid that SIL verification issue, and reporting the remaining issues appears your only choice.
Did you ever talk to @sebsto about using his ALI2023 toolchain and maybe making that official?
yes, i figured as much, so i’ve been setting aside a couple hours each day to investigate these crashes as i run into them, and gotten minimal reproducers for nine of them so far:
opened 04:30AM - 14 Feb 24 UTC
bug
crash
triage needed
### Description
this crashes the 5.10 compiler
### Reproduction
```swift
s… truct E:~Copyable
{
let r:Range<Int>
consuming
func f()
{
(consume self).r.upperBound
}
}
```
### Stack dump
```text
<stdin>:9:26: warning: expression of type 'Int' is unused
(consume self).r.upperBound
~~~~~~~~~~~~~~~~~^~~~~~~~~~
(consume_expr type='E' location=<stdin>:9:10 range=[<stdin>:9:10 - line:9:18]
(load_expr implicit type='E' location=<stdin>:9:18 range=[<stdin>:9:18 - line:9:18]
(declref_expr type='@lvalue E' location=<stdin>:9:18 range=[<stdin>:9:18 - line:9:18] decl=main.(file).E.f().self@<stdin>:7:10 function_ref=unapplied)))<unknown>:0: error: fatal error encountered during compilation; please submit a bug report (https://swift.org/contributing/#reporting-bugs)
<unknown>:0: note: Unimplemented node!
Stack dump:
0. Program arguments: /usr/bin/swift-frontend -frontend -interpret - -disable-objc-interop -I swiftfiddle.com/_Packages/.build/release -new-driver-path /usr/bin/swift-driver -empty-abi-descriptor -resource-dir /usr/lib/swift -module-name main -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -l_Packages
1. Swift version 5.10-dev (LLVM dbfaba0078e9380, Swift 63c8b551eb2f613)
2. Compiling with the current language version
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for module main)
4. While silgen emitFunction SIL function "@$s4main1EV1fyyF".
for 'f()' (at <stdin>:7: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):
/usr/bin/swift-frontend(+0x7307d73)[0x5647539e7d73]
/usr/bin/swift-frontend(+0x7305abe)[0x5647539e5abe]
/usr/bin/swift-frontend(+0x73080ea)[0x5647539e80ea]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7fc43c13c520]
/lib/x86_64-linux-gnu/libc.so.6(pthread_kill+0x12c)[0x7fc43c1909fc]
/lib/x86_64-linux-gnu/libc.so.6(raise+0x16)[0x7fc43c13c476]
/lib/x86_64-linux-gnu/libc.so.6(abort+0xd3)[0x7fc43c1227f3]
/usr/bin/swift-frontend(+0xe3f95d)[0x56474d51f95d]
/usr/bin/swift-frontend(+0x7227d1b)[0x564753907d1b]
/usr/bin/swift-frontend(+0x7227bf6)[0x564753907bf6]
/usr/bin/swift-frontend(+0x15b7be7)[0x56474dc97be7]
/usr/bin/swift-frontend(+0x15a7586)[0x56474dc87586]
/usr/bin/swift-frontend(+0x15b7918)[0x56474dc97918]
/usr/bin/swift-frontend(+0x15a7522)[0x56474dc87522]
/usr/bin/swift-frontend(+0x15a6d9c)[0x56474dc86d9c]
/usr/bin/swift-frontend(+0x15ac0d0)[0x56474dc8c0d0]
/usr/bin/swift-frontend(+0x15a6254)[0x56474dc86254]
/usr/bin/swift-frontend(+0x15a5f4f)[0x56474dc85f4f]
/usr/bin/swift-frontend(+0x15772e1)[0x56474dc572e1]
/usr/bin/swift-frontend(+0x15727af)[0x56474dc527af]
/usr/bin/swift-frontend(+0x1567451)[0x56474dc47451]
/usr/bin/swift-frontend(+0x15fe6cb)[0x56474dcde6cb]
/usr/bin/swift-frontend(+0x15fd15d)[0x56474dcdd15d]
/usr/bin/swift-frontend(+0x1592d99)[0x56474dc72d99]
/usr/bin/swift-frontend(+0x151827d)[0x56474dbf827d]
/usr/bin/swift-frontend(+0x151931c)[0x56474dbf931c]
/usr/bin/swift-frontend(+0x15166f4)[0x56474dbf66f4]
/usr/bin/swift-frontend(+0x1612c92)[0x56474dcf2c92]
/usr/bin/swift-frontend(+0x160eef4)[0x56474dceeef4]
/usr/bin/swift-frontend(+0x160ec08)[0x56474dceec08]
/usr/bin/swift-frontend(+0x151c5c7)[0x56474dbfc5c7]
/usr/bin/swift-frontend(+0x15fca8c)[0x56474dcdca8c]
/usr/bin/swift-frontend(+0x151f8df)[0x56474dbff8df]
/usr/bin/swift-frontend(+0x151cfdf)[0x56474dbfcfdf]
/usr/bin/swift-frontend(+0xe34965)[0x56474d514965]
/usr/bin/swift-frontend(+0xe4a7f5)[0x56474d52a7f5]
/usr/bin/swift-frontend(+0xe382ad)[0x56474d5182ad]
/usr/bin/swift-frontend(+0xe369db)[0x56474d5169db]
/usr/bin/swift-frontend(+0xcc3315)[0x56474d3a3315]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7fc43c123d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7fc43c123e40]
/usr/bin/swift-frontend(+0xcc2375)[0x56474d3a2375]
*** Signal 11: Backtracing from 0x7fc43c122898... done ***
*** Program crashed: Bad pointer dereference at 0x0000000000000000 ***
Thread 0 "swift-frontend" crashed:
0 0x00007fc43c122898 <unknown> in libc.so.6
Registers:
rax 0x0000000000000000 0
rdx 0x00007fc43bff9840 40 98 ff 3b c4 7f 00 00 60 a2 ff 3b c4 7f 00 00 @·ÿ;Ä···`¢ÿ;Ä···
rcx 0x00007fc43c1909fc 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 0x00007fc43c315e90 01 00 00 00 01 00 00 00 40 98 ff 3b c4 7f 00 00 ········@·ÿ;Ä···
rsp 0x00007ffd87103a30 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ···············
r8 0x0000000000000000 0
r9 0x0000000000000000 0
r10 0x0000000000000008 8
r11 0x0000000000000246 582
r12 0x00007ffd87104050 d0 42 10 87 fd 7f 00 00 08 4c 10 87 fd 7f 00 00 ÐB··ý····L··ý···
r13 0x00007ffd87103f10 29 88 1a 55 47 56 00 00 cd 87 ee 4e 47 56 00 00 )··UGV··Í·îNGV··
r14 0x0000000000000001 1
r15 0x0000000000000000 0
rip 0x00007fc43c122898 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 (23 omitted):
0x00007fc43c0fa000–0x00007fc43c2b6341 c289da5071a3399de893d2af81d6a30c62646e1e libc.so.6 /usr/lib/x86_64-linux-gnu/libc.so.6
Backtrace took 0.00s
```
### Expected behavior
it worked in 5.9
### Environment
Swift version 5.10-dev (LLVM dbfaba0078e9380, Swift 63c8b551eb2f613)
Target: x86_64-unknown-linux-gnu
### Additional information
[SwiftFiddle](https://swiftfiddle.com/h6dinxdvm5drte7o655eckki2q?c=H4sIAAAAAAAAAy2OPQvCMBiE%2F0p4pxY06OASxEHp4OqcpcYkFuIl5EMoJf52K%2FG253gObiFFgiRSjkVlNojPxYd5vDstsUiwNU5nFsVthNXHK%2FJJovXKI5XXBNvQFChmur7Rf%2FtL10TNknam55GXEHQ8%2B4JHk6pEpQ291yOY7DO7eXvg%2Bx3VL9tmklqdAAAA)
opened 05:00AM - 14 Feb 24 UTC
bug
crash
triage needed
### Description
what an interesting bug! it crashes on both main and 5.10
### … Reproduction
```swift
struct A1:P
{
}
struct A2:P
{
}
func create(in x:A1)
{
let y:A1 = x.create()
let z:A2 = y.create()
}
protocol P
{
}
extension P
{
func create<T>(as _:T.Type = Self.self) -> T where T:P
{
fatalError()
}
}
```
### Stack dump
```text
swift-frontend: /home/build-user/swift/lib/SIL/IR/SILType.cpp:806: bool swift::SILType::hasAbstractionDifference(swift::SILFunctionTypeRepresentation, swift::SILType): Assertion `getSILFunctionLanguage(rep) == SILFunctionLanguage::C || areOnlyAbstractionDifferent(ct1, ct2)' failed.
Stack dump:
0. Program arguments: /usr/bin/swift-frontend -frontend -interpret - -disable-objc-interop -I swiftfiddle.com/_Packages/.build/release -enable-bare-slash-regex -empty-abi-descriptor -resource-dir /usr/lib/swift -module-name main -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -l_Packages
1. Swift version 5.11-dev (LLVM 1bcf1d71b715d0d, Swift 009a93a0f83dd5c)
2. Compiling with the current language version
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for module main)
4. While silgen emitFunction SIL function "@$s4main6create2inyAA2A1V_tF".
for 'create(in:)' (at <stdin>:7:1)
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 0x00005622f8bd6317
1 swift-frontend 0x00005622f8bd406e
2 swift-frontend 0x00005622f8bd698a
3 libc.so.6 0x00007f99e878d520
4 libc.so.6 0x00007f99e87e19fc pthread_kill + 300
5 libc.so.6 0x00007f99e878d476 raise + 22
6 libc.so.6 0x00007f99e87737f3 abort + 211
7 libc.so.6 0x00007f99e877371b
8 libc.so.6 0x00007f99e8784e96
9 swift-frontend 0x00005622f311e2bb
10 swift-frontend 0x00005622f27a520d
11 swift-frontend 0x00005622f27a50a7
12 swift-frontend 0x00005622f27b5f7a
13 swift-frontend 0x00005622f26d93ae
14 swift-frontend 0x00005622f27d109e
15 swift-frontend 0x00005622f27b8a03
16 swift-frontend 0x00005622f27d803a
17 swift-frontend 0x00005622f27bca44
18 swift-frontend 0x00005622f27ba3cd
19 swift-frontend 0x00005622f26e6864
20 swift-frontend 0x00005622f26d6796
21 swift-frontend 0x00005622f26bd6ec
22 swift-frontend 0x00005622f26c5882
23 swift-frontend 0x00005622f277b28a
24 swift-frontend 0x00005622f2779e6d
25 swift-frontend 0x00005622f2707f35
26 swift-frontend 0x00005622f2683bec
27 swift-frontend 0x00005622f2684c92
28 swift-frontend 0x00005622f2682013
29 swift-frontend 0x00005622f2687f9f
30 swift-frontend 0x00005622f2779794
31 swift-frontend 0x00005622f268d612
32 swift-frontend 0x00005622f26889f3
33 swift-frontend 0x00005622f1f1a667
34 swift-frontend 0x00005622f1f309f5
35 swift-frontend 0x00005622f1f1e095
36 swift-frontend 0x00005622f1f1c71d
37 swift-frontend 0x00005622f1d1319c
38 libc.so.6 0x00007f99e8774d90
39 libc.so.6 0x00007f99e8774e40 __libc_start_main + 128
40 swift-frontend 0x00005622f1d12045
*** Signal 11: Backtracing from 0x7f99e8773898...
done ***
*** Program crashed: Bad pointer dereference at 0x0000000000000000 ***
Thread 0 "swift-frontend" crashed:
0 0x00007f99e8773898 <unknown> in libc.so.6
Registers:
rax 0x0000000000000000 0
rdx 0x00007f99e8639880 80 98 63 e8 99 7f 00 00 a0 a2 63 e8 99 7f 00 00 ··cè···· ¢cè····
rcx 0x00007f99e87e19fc 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 0x00007f99e8966e90 01 00 00 00 01 00 00 00 80 98 63 e8 99 7f 00 00 ··········cè····
rsp 0x00007fffd075d520 20 00 00 00 00 00 00 00 a0 66 96 e8 99 7f 00 00 ······· f·è····
r8 0x0000000000000000 0
r9 0x0000000000000000 0
r10 0x0000000000000008 8
r11 0x0000000000000246 582
r12 0x00005622fa5ab708 2f 68 6f 6d 65 2f 62 75 69 6c 64 2d 75 73 65 72 /home/build-user
r13 0x0000000000000326 806
r14 0x00005622fa5abb1f 67 65 74 53 49 4c 46 75 6e 63 74 69 6f 6e 4c 61 getSILFunctionLa
r15 0x00007f99e00da538 c0 ec 2c fd 22 56 00 00 ff ff ff ff ff ff ff ff Àì,ý"V··ÿÿÿÿÿÿÿÿ
rip 0x00007f99e8773898 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 (24 omitted):
0x00007f99e874b000–0x00007f99e8907341 c289da5071a3399de893d2af81d6a30c62646e1e libc.so.6 /usr/lib/x86_64-linux-gnu/libc.so.6
Backtrace took 0.10s
```
### Expected behavior
it worked in 5.9
### Environment
Swift version 5.11-dev (LLVM 1bcf1d71b715d0d, Swift 009a93a0f83dd5c)
Target: x86_64-unknown-linux-gnu
### Additional information
_No response_
opened 05:41AM - 14 Feb 24 UTC
bug
triage needed
### Description
it told me to file a bug
```
error: 'consume' applied to v… alue that the compiler does not support. This is a compiler bug. Please file a bug with a small example of the bug
_ = consume x
^
error: fatalError
```
### Reproduction
```swift
func f()
{
var x:[Int] = []
_ = consume x
}
```
### Expected behavior
it worked in 5.9
### Environment
Swift version 5.10-dev (LLVM dbfaba0078e9380, Swift 63c8b551eb2f613)
Target: x86_64-unknown-linux-gnu
### Additional information
it happens [on 5.10](https://swiftfiddle.com/?c=H4sIAAAAAAAAA6tWSlayUkorzUtWSNPQjMmrjslTAIKyxCKFCqtoz7ySWAVbhehYiGg8kJ2cn1dcmpuqUBGTVxuTp6SjVAbUn5eZnlGSU6lrqmdooFQLAB0e%2BjdUAAAA) and also happens [on main](https://swiftfiddle.com/?c=H4sIAAAAAAAAA6tWSlayUkorzUtWSNPQjMmrjslTAIKyxCKFCqtoz7ySWAVbhehYiGg8kJ2cn1dcmpuqUBGTVxuTp6SjVAbUn5eZnlGSU6mbm5iZp1QLAOh%2FH2VUAAAA)
opened 05:55AM - 14 Feb 24 UTC
bug
crash
triage needed
### Description
this crashes the 5.10 compiler. it hits the same assertion as h… ttps://github.com/apple/swift/issues/71598
### Reproduction
```swift
struct T:~Copyable
{
var r:Range<Int> { fatalError() }
var y:Int { self.r.upperBound }
}
```
### Stack dump
```text
swift-frontend: /home/build-user/swift/lib/SILGen/SILGenLValue.cpp:3332: void swift::Lowering::LValue::addNonMemberVarComponent(swift::Lowering::SILGenFunction &, swift::SILLocation, swift::VarDecl *, swift::SubstitutionMap, swift::Lowering::LValueOptions, swift::Lowering::SGFAccessKind, swift::AccessStrategy, swift::CanType, llvm::Optional<ActorIsolation>)::NonMemberVarAccessEmitter::emitUsingStorage(swift::Lowering::LValueTypeData): Assertion `address.isLValue() && "Must have a physical copyable lvalue decl ref that " "evaluates to an address"' failed.
Stack dump:
0. Program arguments: /usr/bin/swift-frontend -frontend -interpret - -disable-objc-interop -I swiftfiddle.com/_Packages/.build/release -new-driver-path /usr/bin/swift-driver -empty-abi-descriptor -resource-dir /usr/lib/swift -module-name main -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -l_Packages
1. Swift version 5.10-dev (LLVM dbfaba0078e9380, Swift 63c8b551eb2f613)
2. Compiling with the current language version
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for module main)
4. While silgen emitFunction SIL function "@$s4main1TV1ySivg".
for getter for y (at <stdin>:5:9)
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):
/usr/bin/swift-frontend(+0x7307d73)[0x55fcca57bd73]
/usr/bin/swift-frontend(+0x7305abe)[0x55fcca579abe]
/usr/bin/swift-frontend(+0x73080ea)[0x55fcca57c0ea]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f40248b8520]
/lib/x86_64-linux-gnu/libc.so.6(pthread_kill+0x12c)[0x7f402490c9fc]
/lib/x86_64-linux-gnu/libc.so.6(raise+0x16)[0x7f40248b8476]
/lib/x86_64-linux-gnu/libc.so.6(abort+0xd3)[0x7f402489e7f3]
/lib/x86_64-linux-gnu/libc.so.6(+0x2871b)[0x7f402489e71b]
/lib/x86_64-linux-gnu/libc.so.6(+0x39e96)[0x7f40248afe96]
/usr/bin/swift-frontend(+0x15a8778)[0x55fcc481c778]
/usr/bin/swift-frontend(+0x15a99b2)[0x55fcc481d9b2]
/usr/bin/swift-frontend(+0x15aa55d)[0x55fcc481e55d]
/usr/bin/swift-frontend(+0x15b76d5)[0x55fcc482b6d5]
/usr/bin/swift-frontend(+0x15a74be)[0x55fcc481b4be]
/usr/bin/swift-frontend(+0x15b7918)[0x55fcc482b918]
/usr/bin/swift-frontend(+0x15a7522)[0x55fcc481b522]
/usr/bin/swift-frontend(+0x15a6d9c)[0x55fcc481ad9c]
/usr/bin/swift-frontend(+0x15ac0d0)[0x55fcc48200d0]
/usr/bin/swift-frontend(+0x15a6254)[0x55fcc481a254]
/usr/bin/swift-frontend(+0x15a5f4f)[0x55fcc4819f4f]
/usr/bin/swift-frontend(+0x15772e1)[0x55fcc47eb2e1]
/usr/bin/swift-frontend(+0x15727af)[0x55fcc47e67af]
/usr/bin/swift-frontend(+0x1563d96)[0x55fcc47d7d96]
/usr/bin/swift-frontend(+0x16012a5)[0x55fcc48752a5]
/usr/bin/swift-frontend(+0x15ff7a2)[0x55fcc48737a2]
/usr/bin/swift-frontend(+0x15fe743)[0x55fcc4872743]
/usr/bin/swift-frontend(+0x15fd15d)[0x55fcc487115d]
/usr/bin/swift-frontend(+0x1592d99)[0x55fcc4806d99]
/usr/bin/swift-frontend(+0x151827d)[0x55fcc478c27d]
/usr/bin/swift-frontend(+0x151931c)[0x55fcc478d31c]
/usr/bin/swift-frontend(+0x15166f4)[0x55fcc478a6f4]
/usr/bin/swift-frontend(+0x1612c92)[0x55fcc4886c92]
/usr/bin/swift-frontend(+0x280a0fa)[0x55fcc5a7e0fa]
/usr/bin/swift-frontend(+0x1612ea3)[0x55fcc4886ea3]
/usr/bin/swift-frontend(+0x1612c2a)[0x55fcc4886c2a]
/usr/bin/swift-frontend(+0x160eede)[0x55fcc4882ede]
/usr/bin/swift-frontend(+0x160ec08)[0x55fcc4882c08]
/usr/bin/swift-frontend(+0x151c5c7)[0x55fcc47905c7]
/usr/bin/swift-frontend(+0x15fca8c)[0x55fcc4870a8c]
/usr/bin/swift-frontend(+0x151f8df)[0x55fcc47938df]
/usr/bin/swift-frontend(+0x151cfdf)[0x55fcc4790fdf]
/usr/bin/swift-frontend(+0xe34965)[0x55fcc40a8965]
/usr/bin/swift-frontend(+0xe4a7f5)[0x55fcc40be7f5]
/usr/bin/swift-frontend(+0xe382ad)[0x55fcc40ac2ad]
/usr/bin/swift-frontend(+0xe369db)[0x55fcc40aa9db]
/usr/bin/swift-frontend(+0xcc3315)[0x55fcc3f37315]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7f402489fd90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7f402489fe40]
/usr/bin/swift-frontend(+0xcc2375)[0x55fcc3f36375]
*** Signal 11: Backtracing from 0x7f402489e898...
done ***
*** Program crashed: Bad pointer dereference at 0x0000000000000000 ***
Thread 0 "swift-frontend" crashed:
0 0x00007f402489e898 <unknown> in libc.so.6
Registers:
rax 0x0000000000000000 0
rdx 0x00007f4024775840 40 58 77 24 40 7f 00 00 60 62 77 24 40 7f 00 00 @Xw$@···`bw$@···
rcx 0x00007f402490c9fc 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 0x00007f4024a91e90 01 00 00 00 01 00 00 00 40 58 77 24 40 7f 00 00 ········@Xw$@···
rsp 0x00007fffd97b94c0 20 00 00 00 00 00 00 00 a0 16 a9 24 40 7f 00 00 ······· ·©$@···
r8 0x0000000000000000 0
r9 0x0000000000000000 0
r10 0x0000000000000008 8
r11 0x0000000000000246 582
r12 0x000055fccbd38740 2f 68 6f 6d 65 2f 62 75 69 6c 64 2d 75 73 65 72 /home/build-user
r13 0x0000000000000d04 3332
r14 0x000055fccbd3ccbc 61 64 64 72 65 73 73 2e 69 73 4c 56 61 6c 75 65 address.isLValue
r15 0x0000000000000004 4
rip 0x00007f402489e898 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 (23 omitted):
0x00007f4024876000–0x00007f4024a32341 c289da5071a3399de893d2af81d6a30c62646e1e libc.so.6 /usr/lib/x86_64-linux-gnu/libc.so.6
Backtrace took 0.01s
```
### Expected behavior
it worked on 5.9
### Environment
Swift version 5.10-dev (LLVM dbfaba0078e9380, Swift 63c8b551eb2f613)
Target: x86_64-unknown-linux-gnu
### Additional information
[SwiftFiddle](https://swiftfiddle.com/?c=H4sIAAAAAAAAA6tWSlayUiouKSpNLlEIsapzzi%2BoTEzKSY3Jq47JUwCCssQihSKroMS89FQbz7wSO4VqhbTEksQc16Ki%2FCINTYXamDyEwkoroBKgiuLUnDS9Ir3SgoLUIqf80rwUkDIgUtJRKgNal5eZnlGSU6lrqmdooFQLAJ4zNaiDAAAA), which also crashes [on main](https://swiftfiddle.com/?c=H4sIAAAAAAAAA6tWSlayUiouKSpNLlEIsapzzi%2BoTEzKSY3Jq47JUwCCssQihSKroMS89FQbz7wSO4VqhbTEksQc16Ki%2FCINTYXamDyEwkoroBKgiuLUnDS9Ir3SgoLUIqf80rwUkDIgUtJRKgNal5eZnlGSU6mbm5iZp1QLAGtS0PqDAAAA)
opened 06:02AM - 14 Feb 24 UTC
bug
triage needed
### Description
it told me to file a bug
```
<stdin>:12:17: error: 'consume… ' applied to value that the compiler does not support. This is a compiler bug. Please file a bug with a small example of the bug
_ = consume x
^
```
### Reproduction
```swift
func f()
{
let x:[Int] ; x = []
_ = consume x
}
```
### Expected behavior
it worked on 5.9
### Environment
Swift version 5.11-dev (LLVM 1bcf1d71b715d0d, Swift 009a93a0f83dd5c)
Target: x86_64-unknown-linux-gnu
### Additional information
it also happens [on 5.10](https://swiftfiddle.com/?c=H4sIAAAAAAAAA6tWSlayUkorzUtWSNPQVIjJq47JUwCCnNQShQqraM%2B8klgFa4UKBVuF6FiITDyQnZyfV1yam6pQEZNXq6SjVAY0Ii8zPaMkp1LXVM%2FQQKkWAEocwEpXAAAA)
opened 06:18AM - 14 Feb 24 UTC
bug
crash
triage needed
### Description
the horror
### Reproduction
```swift
func f(x:[Int]?)
{
}
…
func g()
{
let x:[Int]? = nil
return f(x: consume x)
}
```
### Stack dump
```text
Begin Error in Function: '$s4main1gyyF'
Error! Found a leaked owned value that was never consumed.
Value: %2 = move_value [allows_diagnostics] %0 : $Optional<Array<Int>> // user: %4
End Error in Function: '$s4main1gyyF'
Found ownership error?!
triggering standard assertion failure routine
UNREACHABLE executed at /home/build-user/swift/lib/SIL/Verifier/LinearLifetimeCheckerPrivate.h:211!
Stack dump:
0. Program arguments: /usr/bin/swift-frontend -frontend -interpret - -disable-objc-interop -I swiftfiddle.com/_Packages/.build/release -new-driver-path /usr/bin/swift-driver -empty-abi-descriptor -resource-dir /usr/lib/swift -module-name main -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -l_Packages
1. Swift version 5.10-dev (LLVM dbfaba0078e9380, Swift 63c8b551eb2f613)
2. Compiling with the current language version
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for module main)
4. While silgen emitFunction SIL function "@$s4main1gyyF".
for 'g()' (at <stdin>:5:1)
5. While verifying SIL function "@$s4main1gyyF".
for 'g()' (at <stdin>:5:1)
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):
/usr/bin/swift-frontend(+0x7307d73)[0x55ab79230d73]
/usr/bin/swift-frontend(+0x7305abe)[0x55ab7922eabe]
/usr/bin/swift-frontend(+0x73080ea)[0x55ab792310ea]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7fdbbb03e520]
/lib/x86_64-linux-gnu/libc.so.6(pthread_kill+0x12c)[0x7fdbbb0929fc]
/lib/x86_64-linux-gnu/libc.so.6(raise+0x16)[0x7fdbbb03e476]
/lib/x86_64-linux-gnu/libc.so.6(abort+0xd3)[0x7fdbbb0247f3]
/usr/bin/swift-frontend(+0x722811f)[0x55ab7915111f]
/usr/bin/swift-frontend(+0x1fdd0ae)[0x55ab73f060ae]
/usr/bin/swift-frontend(+0x1fe134b)[0x55ab73f0a34b]
/usr/bin/swift-frontend(+0x1fdfabd)[0x55ab73f08abd]
/usr/bin/swift-frontend(+0x1fdf782)[0x55ab73f08782]
/usr/bin/swift-frontend(+0x1fe1ad6)[0x55ab73f0aad6]
/usr/bin/swift-frontend(+0x1fe1969)[0x55ab73f0a969]
/usr/bin/swift-frontend(+0x2009bf2)[0x55ab73f32bf2]
/usr/bin/swift-frontend(+0x200cec4)[0x55ab73f35ec4]
/usr/bin/swift-frontend(+0x1ff1cbf)[0x55ab73f1acbf]
/usr/bin/swift-frontend(+0x1fec2f0)[0x55ab73f152f0]
/usr/bin/swift-frontend(+0x1fea9c9)[0x55ab73f139c9]
/usr/bin/swift-frontend(+0x1fe3462)[0x55ab73f0c462]
/usr/bin/swift-frontend(+0x1518ace)[0x55ab73441ace]
/usr/bin/swift-frontend(+0x15182a3)[0x55ab734412a3]
/usr/bin/swift-frontend(+0x151931c)[0x55ab7344231c]
/usr/bin/swift-frontend(+0x15166f4)[0x55ab7343f6f4]
/usr/bin/swift-frontend(+0x151c5c7)[0x55ab734455c7]
/usr/bin/swift-frontend(+0x15fca8c)[0x55ab73525a8c]
/usr/bin/swift-frontend(+0x151f8df)[0x55ab734488df]
/usr/bin/swift-frontend(+0x151cfdf)[0x55ab73445fdf]
/usr/bin/swift-frontend(+0xe34965)[0x55ab72d5d965]
/usr/bin/swift-frontend(+0xe4a7f5)[0x55ab72d737f5]
/usr/bin/swift-frontend(+0xe382ad)[0x55ab72d612ad]
/usr/bin/swift-frontend(+0xe369db)[0x55ab72d5f9db]
/usr/bin/swift-frontend(+0xcc3315)[0x55ab72bec315]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7fdbbb025d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7fdbbb025e40]
/usr/bin/swift-frontend(+0xcc2375)[0x55ab72beb375]
*** Signal 11: Backtracing from 0x7fdbbb024898... done ***
*** Program crashed: Bad pointer dereference at 0x0000000000000000 ***
Thread 0 "swift-frontend" crashed:
0 0x00007fdbbb024898 <unknown> in libc.so.6
Registers:
rax 0x0000000000000000 0
rdx 0x00007fdbbaefb840 40 b8 ef ba db 7f 00 00 60 c2 ef ba db 7f 00 00 @¸ïºÛ···`ÂïºÛ···
rcx 0x00007fdbbb0929fc 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 0x00007fdbbb217e90 01 00 00 00 01 00 00 00 40 b8 ef ba db 7f 00 00 ········@¸ïºÛ···
rsp 0x00007ffd594be900 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ···············
r8 0x0000000000000000 0
r9 0x0000000000000000 0
r10 0x0000000000000008 8
r11 0x0000000000000246 582
r12 0x0000000000000046 70
r13 0x00007ffd594bedb0 00 00 00 00 00 00 00 00 00 66 5f 7e ab 55 00 00 ·········f_~«U··
r14 0x00000000000000d3 211
r15 0x000055ab7ad0d545 2f 68 6f 6d 65 2f 62 75 69 6c 64 2d 75 73 65 72 /home/build-user
rip 0x00007fdbbb024898 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 (23 omitted):
0x00007fdbbaffc000–0x00007fdbbb1b8341 c289da5071a3399de893d2af81d6a30c62646e1e libc.so.6 /usr/lib/x86_64-linux-gnu/libc.so.6
Backtrace took 0.00s
```
### Expected behavior
it worked in 5.9
### Environment
Swift version 5.10-dev (LLVM dbfaba0078e9380, Swift 63c8b551eb2f613)
Target: x86_64-unknown-linux-gnu
### Additional information
it also crashes [on main](https://swiftfiddle.com/?c=H4sIAAAAAAAAA6tWSlayUorJSyvNS1ZI06iwivbMK4m114zJq47Jq4WKp2tA%2BApAkJNaogBTpWCrkJeZAxEvSi0pLcoDG6GQnJ9XXJqbqlAB1FarpKNUBrQiLzM9oySnUjc3MTNPqRYA7i2Qb3cAAAA%3D)
the crash can be [mitigated](https://swiftfiddle.com/?c=H4sIAAAAAAAAA6tWSlayUorJSyvNS1ZI06iwSs7PKy7NzcxLV4j2zCuJtdeMyauOyauFqkjXgPAVgCAntUShwgqiSsFWIS8zByJelFpSWpQHNkwBYlqqQgVQW62SjlIZ0LK8zPSMkpxKXVM9QwOlWgD9QcKegQAAAA%3D%3D), but not worked around, by making the parameter `consuming` instead of `borrowing`
```diff
- func f(x:[Int]?)
+ func f(x:consuming [Int]?)
{
}
func g()
{
let x:[Int]? = nil
return f(x: consume x)
}
```
opened 01:40AM - 15 Feb 24 UTC
bug
compiler
crash
SymbolGraphGen
triage needed
swift 5.10
### Description
we have again lost the ability to dump the symbol graph for the… standard library
### Reproduction
```bash
$ swift symbolgraph-extract -module-name _Concurrency -target x86_64-unknown-linux-gnu -minimum-access-level internal -output-dir .testing/swift/artifacts -emit-extension-block-symbols -skip-inherited-docs -pretty-print
```
### Stack dump
```text
swift-symbolgraph-extract: /home/ec2-user/swift/lib/SymbolGraphGen/DeclarationFragmentPrinter.h:140: virtual swift::symbolgraphgen::DeclarationFragmentPrinter::~DeclarationFragmentPrinter(): Assertion `NumFragments' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /usr/bin/swift-symbolgraph-extract -module-name _Concurrency -target x86_64-unknown-linux-gnu -minimum-access-level internal -output-dir .testing/swift/artifacts -emit-extension-block-symbols -skip-inherited-docs -pretty-print
1. Swift version 5.10-dev (LLVM dbfaba0078e9380, Swift 63c8b551eb2f613)
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):
/usr/bin/swift-symbolgraph-extract(+0x72e33f4)[0x55b3dbcba3f4]
/usr/bin/swift-symbolgraph-extract(+0x72e10ce)[0x55b3dbcb80ce]
/usr/bin/swift-symbolgraph-extract(+0x72e3768)[0x55b3dbcba768]
/lib64/libc.so.6(+0x54dd0)[0x7f0f30297dd0]
/lib64/libc.so.6(+0xa153c)[0x7f0f302e453c]
/lib64/libc.so.6(raise+0x16)[0x7f0f30297d26]
/lib64/libc.so.6(abort+0xd3)[0x7f0f3026b7f3]
/lib64/libc.so.6(+0x2871b)[0x7f0f3026b71b]
/lib64/libc.so.6(+0x4dcc6)[0x7f0f30290cc6]
/usr/bin/swift-symbolgraph-extract(+0x1c3914a)[0x55b3d661014a]
/usr/bin/swift-symbolgraph-extract(+0x1c40612)[0x55b3d6617612]
/usr/bin/swift-symbolgraph-extract(+0x1c3595d)[0x55b3d660c95d]
/usr/bin/swift-symbolgraph-extract(+0x1c378c9)[0x55b3d660e8c9]
/usr/bin/swift-symbolgraph-extract(+0x1c3fc7e)[0x55b3d6616c7e]
/usr/bin/swift-symbolgraph-extract(+0x1c32e30)[0x55b3d6609e30]
/usr/bin/swift-symbolgraph-extract(+0xceda1b)[0x55b3d56c4a1b]
/usr/bin/swift-symbolgraph-extract(+0x1c3272a)[0x55b3d660972a]
/usr/bin/swift-symbolgraph-extract(+0x1c323a7)[0x55b3d66093a7]
/usr/bin/swift-symbolgraph-extract(+0xd2030f)[0x55b3d56f730f]
/usr/bin/swift-symbolgraph-extract(+0xcc3a20)[0x55b3d569aa20]
/lib64/libc.so.6(+0x3feb0)[0x7f0f30282eb0]
/lib64/libc.so.6(__libc_start_main+0x80)[0x7f0f30282f60]
/usr/bin/swift-symbolgraph-extract(+0xcc1d85)[0x55b3d5698d85]
Aborted (core dumped)
```
### Expected behavior
it worked in 5.9
### Environment
Swift version 5.10-dev (LLVM dbfaba0078e9380, Swift 63c8b551eb2f613)
Target: x86_64-unknown-linux-gnu
### Additional information
the crash only occurs when using `-minimum-access-level internal`. this mode is required, even when the end goal is to only dump public symbols because of a separate issue where lib/SymbolGraphGen over-aggresively deletes nodes resulting in broken symbol graphs.
opened 02:17AM - 18 Feb 24 UTC
bug
crash
triage needed
### Description
this crashes 5.9.2 with assertions enabled
### Reproductio… n
```swift
struct B
{
let x:Bool
let y:String
}
struct C
{
init(b:borrowing B)
{
if b.x
{
let _:String = b.y
}
}
}
class S
{
init(x:Bool)
{
}
}
extension S
{
convenience
init()
{
self.init(x: true)
}
}
```
### Stack dump
```text
SIL verification failed: result of struct_extract does not match type of field
$@moveOnly Bool
$Bool
Verifying instruction:
%5 = begin_borrow %0 : $B // users: %8, %6
-> %6 = struct_extract %5 : $@moveOnly B, #B.x // user: %7
%7 = struct_extract %6 : $Bool, #Bool._value // user: %9
In function:
// C.init(b:)
sil hidden [ossa] @$s4main1CV1bAcA1BVh_tcfC : $@convention(method) (@guaranteed B, @thin C.Type) -> C {
// %0 "b" // users: %4, %5, %3
// %1 "$metatype"
bb0(%0 : @noImplicitCopy @guaranteed $B, %1 : $@thin C.Type):
%2 = alloc_stack $C, var, name "self", implicit // users: %12, %13
%3 = copyable_to_moveonlywrapper [guaranteed] %0 : $B
debug_value [moveable_value_debuginfo] %0 : $B, let, name "b", argno 1 // id: %4
%5 = begin_borrow %0 : $B // users: %8, %6
%6 = struct_extract %5 : $@moveOnly B, #B.x // user: %7
%7 = struct_extract %6 : $Bool, #Bool._value // user: %9
end_borrow %5 : $@moveOnly B // id: %8
cond_br %7, bb1, bb2 // id: %9
bb1: // Preds: bb0
br bb3 // id: %10
bb2: // Preds: bb0
br bb3 // id: %11
bb3: // Preds: bb1 bb2
%12 = load [trivial] %2 : $*C // user: %14
dealloc_stack %2 : $*C // id: %13
return %12 : $C // id: %14
} // end sil function '$s4main1CV1bAcA1BVh_tcfC'
Stack dump:
0. Program arguments: /usr/bin/swift-frontend -frontend -interpret - -disable-objc-interop -I swiftfiddle.com/_Packages/.build/release -new-driver-path /usr/bin/swift-driver -empty-abi-descriptor -resource-dir /usr/lib/swift -module-name main -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -l_Packages
1. Swift version 5.9.2-dev (LLVM 2b42c5ce063a374, Swift 9067148bc9c9a72)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for main)
4. While running pass #96 SILModuleTransform "MandatoryInlining".
5. While verifying SIL function "@$s4main1CV1bAcA1BVh_tcfC".
for 'init(b:)' (at <stdin>:8: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):
/usr/bin/swift-frontend(+0x70ab263)[0x56116adbd263]
/usr/bin/swift-frontend(+0x70a8fae)[0x56116adbafae]
/usr/bin/swift-frontend(+0x70ab5da)[0x56116adbd5da]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f8d67280520]
/lib/x86_64-linux-gnu/libc.so.6(pthread_kill+0x12c)[0x7f8d672d49fc]
/lib/x86_64-linux-gnu/libc.so.6(raise+0x16)[0x7f8d67280476]
/lib/x86_64-linux-gnu/libc.so.6(abort+0xd3)[0x7f8d672667f3]
/usr/bin/swift-frontend(+0x1f5c9d6)[0x561165c6e9d6]
/usr/bin/swift-frontend(+0x1f7b813)[0x561165c8d813]
/usr/bin/swift-frontend(+0x1f611d0)[0x561165c731d0]
/usr/bin/swift-frontend(+0x1f5f8b9)[0x561165c718b9]
/usr/bin/swift-frontend(+0x1f58363)[0x561165c6a363]
/usr/bin/swift-frontend(+0x1f5ba93)[0x561165c6da93]
/usr/bin/swift-frontend(+0x1d1ec90)[0x561165a30c90]
/usr/bin/swift-frontend(+0x1e5e842)[0x561165b70842]
/usr/bin/swift-frontend(+0x1e624eb)[0x561165b744eb]
/usr/bin/swift-frontend(+0x1ab5d2b)[0x5611657c7d2b]
/usr/bin/swift-frontend(+0x1ab5042)[0x5611657c7042]
/usr/bin/swift-frontend(+0x15fb2a2)[0x56116530d2a2]
/usr/bin/swift-frontend(+0x15fd88a)[0x56116530f88a]
/usr/bin/swift-frontend(+0x15f7d08)[0x561165309d08]
/usr/bin/swift-frontend(+0x15f7cbd)[0x561165309cbd]
/usr/bin/swift-frontend(+0x161926a)[0x56116532b26a]
/usr/bin/swift-frontend(+0x1605843)[0x561165317843]
/usr/bin/swift-frontend(+0x15f7f05)[0x561165309f05]
/usr/bin/swift-frontend(+0x16074f1)[0x5611653194f1]
/usr/bin/swift-frontend(+0x10687b7)[0x561164d7a7b7]
/usr/bin/swift-frontend(+0xde0114)[0x561164af2114]
/usr/bin/swift-frontend(+0xddf3ba)[0x561164af13ba]
/usr/bin/swift-frontend(+0xdf4fc5)[0x561164b06fc5]
/usr/bin/swift-frontend(+0xde2479)[0x561164af4479]
/usr/bin/swift-frontend(+0xde11a5)[0x561164af31a5]
/usr/bin/swift-frontend(+0xc2a30b)[0x56116493c30b]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7f8d67267d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7f8d67267e40]
/usr/bin/swift-frontend(+0xc29a65)[0x56116493ba65]
*** Signal 11: Backtracing from 0x7f8d67266898...
done ***
*** Program crashed: Bad pointer dereference at 0x0000000000000000 ***
Thread 0 "swift-frontend" crashed:
0 0x00007f8d67266898 <unknown> in libc.so.6
Registers:
rax 0x0000000000000000 0
rdx 0x00007f8d66f6f840 40 f8 f6 66 8d 7f 00 00 60 02 f7 66 8d 7f 00 00 @øöf····`·÷f····
rcx 0x00007f8d672d49fc 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 0x00007f8d67459e90 01 00 00 00 01 00 00 00 40 f8 f6 66 8d 7f 00 00 ········@øöf····
rsp 0x00007ffc29915c50 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ···············
r8 0x0000000000000000 0
r9 0x0000000000000000 0
r10 0x0000000000000008 8
r11 0x0000000000000246 582
r12 0x0000000000000018 24
r13 0x00007ffc29915f60 ef 73 79 6c 11 56 00 00 f0 60 91 29 fc 7f 00 00 ïsyl·V··ð`·)ü···
r14 0x00007ffc299166e8 00 ea 35 6f 11 56 00 00 90 16 49 6f 11 56 00 00 ·ê5o·V····Io·V··
r15 0x000056116f4b45f0 24 73 34 6d 61 69 6e 31 43 56 31 62 41 63 41 31 $s4main1CV1bAcA1
rip 0x00007f8d67266898 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 (25 omitted):
0x00007f8d6723e000–0x00007f8d673fa341 c289da5071a3399de893d2af81d6a30c62646e1e libc.so.6 /usr/lib/x86_64-linux-gnu/libc.so.6
Backtrace took 0.12s
```
### Expected behavior
it should not crash
### Environment
Swift version 5.9.2-dev (LLVM 2b42c5ce063a374, Swift 9067148bc9c9a72)
Target: x86_64-unknown-linux-gnu
### Additional information
the unrelated class and `convenience` init really are required to reproduce this crash, although i can’t imagine how they could possibly be involved.
[Fiddle](https://swiftfiddle.com/?c=H4sIAAAAAAAAA2WQSwrDIBCGrzK4aqDNrosK3aRHyFYojUxSQUZQmyYE716JtjHUlfo%2FvtGFScaZ8%2FYlPTSCFkEQl0YPE2%2BM0dt55q23igZBQVBO3H4JRcofOt4Za807uqCpkpD11dMDdPW0XRTal3LPFLhG67zpIW3DShck9cM5aPf4NPGemwI4eSSnDBURaWhEUkgSi47%2FqR3qvs79EJ%2BNVdnMjmyMP0hqeHo9n871hYUPzN0vk1UBAAA%3D)
this does not crash on 5.10, or on main.
opened 03:56AM - 14 Feb 24 UTC
closed 03:46PM - 15 Feb 24 UTC
bug
crash
triage needed
### Description
this crashes the 5.10 compiler
### Reproduction
```swift
…
var last:String
{
_read
{
let x:String = ""
yield x
}
}
```
### Stack dump
```text
error: compile command failed due to signal 6 (use -v to see invocation)
swift-frontend: /home/ec2-user/swift/lib/SILGen/SILGenLValue.cpp:3332: void swift::Lowering::LValue::addNonMemberVarComponent(SILGenFunction &, SILLocation, VarDecl *, SubstitutionMap, LValueOptions, SGFAccessKind, AccessStrategy, CanType, llvm::Optional<ActorIsolation>)::NonMemberVarAccessEmitter::emitUsingStorage(LValueTypeData): Assertion `address.isLValue() && "Must have a physical copyable lvalue decl ref that " "evaluates to an address"' failed.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /usr/bin/swift-frontend -frontend -c -primary-file crash5.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -new-driver-path /usr/bin/swift-driver -empty-abi-descriptor -resource-dir /usr/lib/swift -module-name crash5 -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -o /tmp/TemporaryDirectory.5OuXDQ/crash5-1.o
1. Swift version 5.10-dev (LLVM dbfaba0078e9380, Swift 63c8b551eb2f613)
2. Compiling with the current language version
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "crash5.swift")
4. While silgen emitFunction SIL function "@$s6crash54lastSSvr".
for read for last (at crash5.swift:1: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):
/usr/bin/swift-frontend(+0x72e33f4)[0x55f1f34993f4]
/usr/bin/swift-frontend(+0x72e10ce)[0x55f1f34970ce]
/usr/bin/swift-frontend(+0x72e3768)[0x55f1f3499768]
/lib64/libc.so.6(+0x54dd0)[0x7f14760a1dd0]
/lib64/libc.so.6(+0xa153c)[0x7f14760ee53c]
/lib64/libc.so.6(raise+0x16)[0x7f14760a1d26]
/lib64/libc.so.6(abort+0xd3)[0x7f14760757f3]
/lib64/libc.so.6(+0x2871b)[0x7f147607571b]
/lib64/libc.so.6(+0x4dcc6)[0x7f147609acc6]
/usr/bin/swift-frontend(+0x158316b)[0x55f1ed73916b]
/usr/bin/swift-frontend(+0x15843e2)[0x55f1ed73a3e2]
/usr/bin/swift-frontend(+0x1584f29)[0x55f1ed73af29]
/usr/bin/swift-frontend(+0x1580be2)[0x55f1ed736be2]
/usr/bin/swift-frontend(+0x158091f)[0x55f1ed73691f]
/usr/bin/swift-frontend(+0x1628822)[0x55f1ed7de822]
/usr/bin/swift-frontend(+0x1624b3f)[0x55f1ed7dab3f]
/usr/bin/swift-frontend(+0x16116b9)[0x55f1ed7c76b9]
/usr/bin/swift-frontend(+0x1611211)[0x55f1ed7c7211]
/usr/bin/swift-frontend(+0x15d800c)[0x55f1ed78e00c]
/usr/bin/swift-frontend(+0x15d9427)[0x55f1ed78f427]
/usr/bin/swift-frontend(+0x15d7c9d)[0x55f1ed78dc9d]
/usr/bin/swift-frontend(+0x156d9db)[0x55f1ed7239db]
/usr/bin/swift-frontend(+0x14f3c9e)[0x55f1ed6a9c9e]
/usr/bin/swift-frontend(+0x14f4cff)[0x55f1ed6aacff]
/usr/bin/swift-frontend(+0x14f2325)[0x55f1ed6a8325]
/usr/bin/swift-frontend(+0x27f619a)[0x55f1ee9ac19a]
/usr/bin/swift-frontend(+0x14f2153)[0x55f1ed6a8153]
/usr/bin/swift-frontend(+0x14f7f97)[0x55f1ed6adf97]
/usr/bin/swift-frontend(+0x15d75bb)[0x55f1ed78d5bb]
/usr/bin/swift-frontend(+0x14fb1e3)[0x55f1ed6b11e3]
/usr/bin/swift-frontend(+0x14f8db8)[0x55f1ed6aedb8]
/usr/bin/swift-frontend(+0xe122c6)[0x55f1ecfc82c6]
/usr/bin/swift-frontend(+0xe284aa)[0x55f1ecfde4aa]
/usr/bin/swift-frontend(+0xe15dcb)[0x55f1ecfcbdcb]
/usr/bin/swift-frontend(+0xe14533)[0x55f1ecfca533]
/usr/bin/swift-frontend(+0xcc2da3)[0x55f1ece78da3]
/lib64/libc.so.6(+0x3feb0)[0x7f147608ceb0]
/lib64/libc.so.6(__libc_start_main+0x80)[0x7f147608cf60]
/usr/bin/swift-frontend(+0xcc1d85)[0x55f1ece77d85]
error: fatalError
```
### Expected behavior
it compiles fine in 5.9
### Environment
Swift version 5.10-dev (LLVM dbfaba0078e9380, Swift 63c8b551eb2f613)
Target: x86_64-unknown-linux-gnu
### Additional information
it also crashes the 5.10 compiler [on SwiftFiddle](https://swiftfiddle.com/h6dinxdvm5drte7o655eckki2q)
(kudos to @Joe_Groff for fixing the last one!)
i have not been in contact with him, but i actually stumbled upon his dockerfile gist earlier today and tried to build it myself this afternoon, although i ended up having to interrupt the docker build when i went home for the day.
i do not have any authority at Apple (or Amazon for that matter) so i don’t know what role i could play in making these images “official”. i’d be eager to help in any way i can though.
2 Likes
You do not need any authority at those companies to submit a Docker image for AL2023, though I believe the core team has to approve a new official platform. I suggest you and @sebsto submit an image and maybe we can get it in time to have an official 5.10 toolchain for AL2023.
2 Likes
the dockerfiles in that repository do not compile the toolchains, instead they just download and extract a prepackaged toolchain from https://download.swift.org
. i could submit the full dockerfile i used to compile the AL2023 toolchain, but that would be a very large image that takes much longer to build than the other images in that repository. is this something likely to be accepted?
taylorswift:
the dockerfiles in that repository do not compile the toolchains, instead they just download and extract a prepackaged toolchain from https://download.swift.org
. i could submit the full dockerfile i used to compile the AL2023 toolchain, but that would be a very large image that takes much longer to build than the other images in that repository. is this something likely to be accepted?
You're right about most of them, but not those in the swift-ci/ directory : those are used to build the official release and snapshot toolchains, which is why you'll notice they install an older prebuilt Swift 5.8.1 toolchain initially, to build the Swift source in a fresh toolchain on the CI.
sebsto
(Sébastien Stormacq)
February 18, 2024, 9:08am
8
Hello @taylorswift - I'm just discovering this thread.
Thank you for working on this project !
TL;DR
I managed to compile Swift 5.8 and Swift 5.9.x on Amazon Linux 2023 x64 and Graviton. I have scripts to build on EC2, to build on Docker to produce a RPM file, and I'm working on the CI integration.
(Thank you @Finagolfin for your continuous support and your patience)
Here is the script I use to build on EC2
The key points to pay attention to are
You need to install ld.gold
as it is the default linker used by the Swift project. I use this script to build it from the sources.
On aarch64
(Amazon Graviton chipset), we must add a new triplet definition to clang
compiler. I use this patch to do so.
On both platforms, the compilation and packaging works, but there are 4 unit tests that fail. More about that later.
To compile Swift 5.9.x, you must install the binaries for Swift 5.8 first and have swift
available in the PATH
Here are the deliverables I created and you can use / test (I'm keen at receiving feedback)
Actions pending
Review and possible merge the docker and RPM build scripts. Owner: the Swift Installer Script project maintainers @tomerd or @compnerd .
Resolve the 4 failing unit test for Swift 5.8 on the Swift CI Docker project . Owner: me. I have an open thread with @mishal_shah , and maybe @Finagolfin you have ideas too! let me know)
Submit the PR to produce official builds of Swift 5.8 on Amazon Linux 2023
Once official builds are available, update the swift CI docker file to include swift 5.8 in the build container. That will allow to build Swift 5.9 and newer.
More details about the 4 failing unit tests
I started a new thread to discuss about the unit test errors I received.
I'm working on the Amazon Linux 2023 swift build.
The details are in this message
The compilation of the Swift project release/5.8 branch works both on x64 and aarch64 , but I have 4 tests that fail.
********************
Failed Tests (4):
Swift(linux-x86_64) :: Index/Store/output-failure.swift
Swift(linux-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode-archs.swift
Swift(linux-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift
Swift(linux-…
2 Likes
sebsto
(Sébastien Stormacq)
February 18, 2024, 9:26am
9
To address the Swift 5.8 dependency to build Swift 5.9, I proposed the following plan.
start to build 5.8 in the nightly builds and eventually promote the binary package as an official download on swift.org
once available, add the 5.8 download and installation instructions to the Swift CI Docker file and start to build Swift 5.9 and beyond
i have opened a pull request here:
apple:main
← tayloraswift:main
opened 05:34AM - 18 Feb 24 UTC
adds dockerfiles for Amazon Linux 2023
it also includes speculative dockerfiles for downloading the AL2023 toolchains from download.swift.org . however, this would likely require swift.org to also distribute ld.gold binaries, as we probably don’t want to build those in the dockerfile.
sigh… even with assertions disabled, this custom toolchain is unable to compile anything in release mode (debug mode is unaffected)
/usr/bin/../lib/gcc/x86_64-amazon-linux/11/libstdc++.a(eh_throw.o)(.note.stapsdt+0x14): error: relocation refers to local symbol ".text.__cxa_throw" [4], which is defined in a discarded section
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
although the error message suggests to pass a -v
flag, this does not do anything except parrot the ld.gold version:
$ swift build -c release -Xlinker -v
Building for production...
error: link command failed with exit code 1 (use -v to see invocation)
GNU gold (GNU Binutils 2.42.50.20240218) 1.16
/usr/bin/../lib/gcc/x86_64-amazon-linux/11/libstdc++.a(eh_throw.o)(.note.stapsdt+0x14): error: relocation refers to local symbol ".text.__cxa_throw" [4], which is defined in a discarded section
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
error: fatalError
i’m guessing this has something to do with the unofficial ld.gold linker in the image, although i don’t know enough about the linker to understand what is going on here.
update: so i found that passing -Xswiftc -use-ld=ld
to the swift build -c release
command works, as the problem is specific to the gold linker. sadly, this will not fly with SPM users due to that build system’s aversion to unsafe flags, but for our purposes it is a satisfactory workaround for compiling a server application, as supporting library users is not a top priority right now.
1 Like
sebsto
(Sébastien Stormacq)
February 18, 2024, 8:10pm
12
I am not sure I understand.
These containers do not see to include ld.gold
, therefore the build is likely to fail. Also, these container do not include tools such as tar
and diff
which are required for the packaging and the test. I'm pretty sure the build with these are going to fail. Did I miss something ?
On a side note, yum
is deprecated in Amazon Linux 2023 , you should use dnf
instead.
Also, it is possible to build ld.gold
in a container and only include the binary in the container used for the build, to avoid overhead.
Look at the solution I used here
# Stage 1 : add ld.gold
# ld.gold is not part of Amazon Linux 2023, see https://github.com/amazonlinux/amazon-linux-2023/issues/330
FROM amazonlinux:2023 as GOLD
LABEL PURPOSE="This image is an intermediate image to build the ld.gold linker"
RUN dnf install -y \
gmp-devel \
mpfr-devel \
texinfo \
bison \
git \
gcc-c++
RUN mkdir ld.gold \
&& cd ld.gold \
&& git clone --depth 1 git://sourceware.org/git/binutils-gdb.git binutils \
&& mkdir build && cd build \
&& ../binutils/configure --enable-gold --enable-plugins --disable-werror \
&& make all-gold \
&& cd gold \
This file has been truncated. show original
sebsto:
I am not sure I understand. These containers do not see to include ld.gold
, therefore the build is likely to fail. Also, these container do not include tools such as tar
and diff
which are required for the packaging and the test. I'm pretty sure the build with these are going to fail. Did I miss something ?
based on @Finagolfin ’s explanation, i believe that the first dockerfile provides the environment that the swift CI loads before running utils/build-script
, and this is the dockerfile that needs to have ld.gold. i built a toolchain overnight using this dockerfile as a base layer, so i know it works in at least one environment.
the version-specific dockerfiles install tar
ephemerally before extracting the package and the “slim” images remove it immediately afterwards.
i originally anticipated that we would need to ship ld.gold with the version-specific dockerfiles as well, but as i mentioned earlier, ld.gold isn’t usable in the images anyways, so toolchain users need to specify use-ld=ld
to compile anything in release mode.
updated here
sebsto
(Sébastien Stormacq)
February 18, 2024, 9:05pm
14
Thank you - I think I need to dive deeper and fully understand the purpose of the Dockerfile
under version-name directories :-)
You're correct for the Dockerfile nested under swift-ci
that's the one the CI uses to build the sources. Sources are hosted outside of the container. For my tests, I have them in a separate directory.
i originally anticipated that we would need to ship ld.gold with the version-specific dockerfiles as well, but as i mentioned earlier, ld.gold isn’t usable in the images anyways, so toolchain users need to specify use-ld=ld
to compile anything in release mode.
It is for me. I manage to build 5.8 in the container, without changing anything to the source tree for the x64 build and with one tiny patch to clang
for the aarch64
build
I am now trying to build 5.9 with the container + Swift 5.8
i probably wasn’t clear enough, ld.gold is usable for building the toolchain itself, but this toolchain will not be able to use ld.gold to compile a project of sufficient complexity. instead, you must use the ld
linker. one way to do this is to pass Xlinker
flags when building your application. but anecdotally, symlinking /usr/bin/ld.gold
to /bin/ld
also worked for me.
i was also confused by the layout of the swift-docker repository.
1 Like
Have you tried using lld instead? If it works well, you guys should submit patches to change the Swift default on Amazon Linux to lld. Should be easy to do in the legacy C++ Driver with a compile-time check and you can do something similar in the new swift-driver too.
sebsto
(Sébastien Stormacq)
February 19, 2024, 7:04am
17
I confirm the Dockerfile under the VERSION
directories (i.e. 5.8, 5.9 etc) are runtime environments for Swift apps. The SLIM one is the absolute minimum OS. The Dockerfile under swift-ci
is the build environment for the toolchain itself.
sebsto
(Sébastien Stormacq)
February 19, 2024, 7:05am
18
I think the long term solution is indeed to modify Swift to use ld
on Amazon Linux 2023. I like the short term solution proposed by @taylorswift : just symlinking /usr/bin/ld.gold
to /bin/ld
sebsto
(Sébastien Stormacq)
February 19, 2024, 7:20am
19
@Finagolfin talking about patches
to compile on Graviton (`aarch64), there is a patch needed. Here is my upstream PR. Is there a chance to get this accepted ? And, ideally, to have it backported to the 5.9 branches ?
apple:next
← sebsto:sebsto/ali2023/aarch64
opened 02:14PM - 17 Feb 24 UTC
add `aarch64-amazon-linux` triplet to allow compilation for Amazon Linux 2023 on… Graviton CPU
This should address https://github.com/apple/llvm-project/issues/8227
Are these the only places to modify the swift driver to force the usage of ld
on Amazon Linux 2023 ?
assert(context.Output.getPrimaryOutputType() == file_types::TY_AutolinkFile);
InvocationInfo II{"swift-autolink-extract"};
ArgStringList &Arguments = II.Arguments;
II.allowsResponseFiles = true;
addPrimaryInputsOfType(Arguments, context.Inputs, context.Args,
file_types::TY_Object);
addPrimaryInputsOfType(Arguments, context.Inputs, context.Args,
file_types::TY_LLVM_BC);
addInputsOfType(Arguments, context.InputActions, file_types::TY_Object);
addInputsOfType(Arguments, context.InputActions, file_types::TY_LLVM_BC);
Arguments.push_back("-o");
Arguments.push_back(
context.Args.MakeArgString(context.Output.getPrimaryOutputFilename()));
return II;
}
std::string toolchains::GenericUnix::getDefaultLinker() const {
targetTriple.environment == .android {
return "lld"
}
switch targetTriple.arch {
case .arm, .aarch64, .armeb, .thumb, .thumbeb:
// BFD linker has issues wrt relocation of the protocol conformance
// section on these targets, it also generates COPY relocations for
// final executables, as such, unless specified, we default to gold
// linker.
return "gold"
case .x86, .x86_64, .ppc64, .ppc64le, .systemz:
// BFD linker has issues wrt relocations against protected symbols.
return "gold"
default:
// Otherwise, use the default BFD linker.
return ""
}
}
private func majorArchitectureName(for triple: Triple) -> String {
5.9 is no longer taking patches at this point. The bar for 5.10 is very high as well.