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 `address.isLValue() && "Must have a physical copyable lvalue decl ref that " "evaluates to an address"' failed #71606

Closed
tayloraswift opened this issue Feb 14, 2024 · 1 comment · Fixed by #71908
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

this crashes the 5.10 compiler. it hits the same assertion as #71598

Reproduction

struct T:~Copyable
{
    var r:Range<Int> { fatalError() }

    var y:Int { self.r.upperBound }
}

Stack dump

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 63c8b55)
Target: x86_64-unknown-linux-gnu

Additional information

SwiftFiddle, which also crashes on main

@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
@MaxDesiatov MaxDesiatov added SILGen Area → compiler: The SIL generation stage and removed triage needed This issue needs more specific labels labels Feb 19, 2024
jckarter added a commit to jckarter/swift that referenced this issue Feb 27, 2024
Following up from swiftlang#71795, we must borrow the base of any non-copyable
`borrowing`/`nonmutating` accessor, and we want to borrow the base
of any accessor appearing in a `borrow` expr. Fixes swiftlang#71606.
@jckarter
Copy link
Contributor

#71908 should fix it.

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

Successfully merging a pull request may close this issue.

3 participants