Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertion failed swift::SILType::hasAbstractionDifference #71602

Open
tayloraswift opened this issue Feb 14, 2024 · 0 comments
Open

assertion failed swift::SILType::hasAbstractionDifference #71602

tayloraswift opened this issue Feb 14, 2024 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software SILGen Area → compiler: The SIL generation stage

Comments

@tayloraswift
Copy link
Member

Description

what an interesting bug! it crashes on both main and 5.10

Reproduction

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

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 009a93a)
Target: x86_64-unknown-linux-gnu

Additional information

No response

@tayloraswift tayloraswift added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels labels Feb 14, 2024
@hborla hborla added SILGen Area → compiler: The SIL generation stage and removed triage needed This issue needs more specific labels labels Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software SILGen Area → compiler: The SIL generation stage
Projects
None yet
Development

No branches or pull requests

2 participants