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

[SR-3030] SIL verification failed: function_ref inside fragile function cannot reference a private or hidden symbol #45620

Closed
rxwei opened this issue Oct 24, 2016 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software SILGen Area → compiler: The SIL generation stage

Comments

@rxwei
Copy link
Member

rxwei commented Oct 24, 2016

Previous ID SR-3030
Radar None
Original Reporter @rxwei
Type Bug
Status Resolved
Resolution Won't Do
Environment

Swift 3.0-RELEASE and 3.0.1-PREVIEW-3 on Ubuntu

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, SILGen
Assignee None
Priority Medium

md5: f78687d4996fe265160c6e1857c8fef1

Issue Description:

@inline(__always)
public mutating func withUnsafeMutableDevicePointer<Result>
    (_ body: (UnsafeMutableDevicePointer<Element>) throws -> Result) rethrows -> Result {
    return try body(cowBuffer.baseAddress)
}

cowBuffer is a private computed property with a mutating getter. It crashes whenever a @inline(__always) public mutating function accesses the private mutating getter.

Full code here:
Value.swift

Crash:

Compile Swift Module 'CUDARuntime' (5 sources)
SIL verification failed: function_ref inside fragile function cannot reference a private or hidden symbol: (SingleFunction && RefF->isExternalDeclaration()) || RefF->hasValidLinkageForFragileRef()
Verifying instruction:
->   // function_ref DeviceValue.cowBuffer.getter
  %8 = function_ref @_TFV11CUDARuntime11DeviceValuegP33_1796BCA23AA1B44236F49F1EC84F61329cowBufferGCS_P33_1796BCA23AA1B44236F49F1EC84F613217DeviceValueBufferx_ : $@convention(method) <τ_0_0> (@inout DeviceValue<τ_0_0>) -> @owned DeviceValueBuffer<τ_0_0>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":64:25, scope 0 // user: %9
     %9 = apply %8<Wrapped>(%5) : $@convention(method) <τ_0_0> (@inout DeviceValue<τ_0_0>) -> @owned DeviceValueBuffer<τ_0_0>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":64:25, scope 0 // users: %14, %21, %10
In function:
sil_scope 1 { loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":62:26 parent @_TFV11CUDARuntime11DeviceValue30withUnsafeMutableDevicePointerurfzFzGVS_26UnsafeMutableDevicePointerx_qd__qd__ : $@convention(method) <τ_0_0><τ_1_0> (@owned @callee_owned (UnsafeMutableDevicePointer<τ_0_0>) -> (@out τ_1_0, @error Error), @inout DeviceValue<τ_0_0>) -> (@out τ_1_0, @error Error) }
sil_scope 2 { loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":65:5 parent 1 }

// DeviceValue.withUnsafeMutableDevicePointer<A> ((UnsafeMutableDevicePointer<A>) throws -> A1) throws -> A1
sil [fragile] [always_inline] @_TFV11CUDARuntime11DeviceValue30withUnsafeMutableDevicePointerurfzFzGVS_26UnsafeMutableDevicePointerx_qd__qd__ : $@convention(method) <Wrapped><Result> (@owned @callee_owned (UnsafeMutableDevicePointer<Wrapped>) -> (@out Result, @error Error), @inout DeviceValue<Wrapped>) -> (@out Result, @error Error) {
// %0                                             // user: %12
// %1                                             // users: %24, %17, %12, %7, %3
// %2                                             // users: %22, %15, %6
bb0(%0 : $*Result, %1 : $@callee_owned (UnsafeMutableDevicePointer<Wrapped>) -> (@out Result, @error Error), %2 : $*DeviceValue<Wrapped>):
  debug_value %1 : $@callee_owned (UnsafeMutableDevicePointer<Wrapped>) -> (@out Result, @error Error), let, name "body", argno 1, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":63:12, scope 1 // id: %3
  %4 = alloc_box $DeviceValue<Wrapped>, var, name "self", argno 2, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":62:26, scope 1 // users: %23, %16, %5
  %5 = project_box %4 : $@box DeviceValue<Wrapped>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":62:26, scope 1 // users: %22, %15, %9, %6
  copy_addr %2 to [initialization] %5 : $*DeviceValue<Wrapped>, scope 1 // id: %6
  strong_retain %1 : $@callee_owned (UnsafeMutableDevicePointer<Wrapped>) -> (@out Result, @error Error), loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":64:20, scope 2 // id: %7
  // function_ref DeviceValue.cowBuffer.getter
  %8 = function_ref @_TFV11CUDARuntime11DeviceValuegP33_1796BCA23AA1B44236F49F1EC84F61329cowBufferGCS_P33_1796BCA23AA1B44236F49F1EC84F613217DeviceValueBufferx_ : $@convention(method) <τ_0_0> (@inout DeviceValue<τ_0_0>) -> @owned DeviceValueBuffer<τ_0_0>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":64:25, scope 2 // user: %9
  %9 = apply %8<Wrapped>(%5) : $@convention(method) <τ_0_0> (@inout DeviceValue<τ_0_0>) -> @owned DeviceValueBuffer<τ_0_0>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":64:25, scope 2 // users: %14, %21, %10
  %10 = ref_element_addr %9 : $DeviceValueBuffer<Wrapped>, #DeviceValueBuffer.address, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":64:35, scope 2 // user: %11
  %11 = load %10 : $*UnsafeMutableDevicePointer<Wrapped>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":64:35, scope 2 // user: %12
  try_apply %1(%0, %11) : $@callee_owned (UnsafeMutableDevicePointer<Wrapped>) -> (@out Result, @error Error), normal bb1, error bb2, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":64:42, scope 2 // id: %12

bb1(%13 : $()):                                   // Preds: bb0
  strong_release %9 : $DeviceValueBuffer<Wrapped>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":64:42, scope 2 // id: %14
  copy_addr %5 to %2 : $*DeviceValue<Wrapped>, scope 2 // id: %15
  strong_release %4 : $@box DeviceValue<Wrapped>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":65:5, scope 2 // id: %16
  strong_release %1 : $@callee_owned (UnsafeMutableDevicePointer<Wrapped>) -> (@out Result, @error Error), loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":65:5, scope 2 // id: %17
  %18 = tuple (), loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":65:5, scope 2 // user: %19
  return %18 : $(), loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":64:9, scope 2 // id: %19

// %20                                            // user: %25
bb2(%20 : $Error):                                // Preds: bb0
  strong_release %9 : $DeviceValueBuffer<Wrapped>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":65:5, scope 2 // id: %21
  copy_addr %5 to %2 : $*DeviceValue<Wrapped>, scope 2 // id: %22
  strong_release %4 : $@box DeviceValue<Wrapped>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":65:5, scope 2 // id: %23
  strong_release %1 : $@callee_owned (UnsafeMutableDevicePointer<Wrapped>) -> (@out Result, @error Error), loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":65:5, scope 2 // id: %24
  throw %20 : $Error, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift":64:42, scope 2 // id: %25
}

0  swift           0x000000000334f818 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift           0x000000000334e016 llvm::sys::RunSignalHandlers() + 54
2  swift           0x0000000003350346
3  libpthread.so.0 0x00007f86f5f263d0
4  libc.so.6       0x00007f86f486e418 gsignal + 56
5  libc.so.6       0x00007f86f487001a abort + 362
6  swift           0x0000000000d008d6
7  swift           0x0000000000d05c60
8  swift           0x0000000000d01edb
9  swift           0x0000000000cfd83e swift::SILFunction::verify(bool) const + 5774
10 swift           0x00000000009379e8
11 swift           0x0000000000940e9d
12 swift           0x0000000000937771
13 swift           0x00000000009dcd4c
14 swift           0x00000000009dc79d
15 swift           0x000000000093dc0b
16 swift           0x000000000093e912 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 482
17 swift           0x000000000093eea6 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 118
18 swift           0x00000000007def4d
19 swift           0x00000000007dae11 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2833
20 swift           0x00000000007a78ab main + 2603
21 libc.so.6       0x00007f86f4859830 __libc_start_main + 240
22 swift           0x00000000007a5429 _start + 41
Stack dump:
0.  Program arguments: /home/xwei12/.swiftenv/versions/3.0.1-PREVIEW-3/usr/bin/swift -frontend -c /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Memory.swift -primary-file /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Error.swift /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Device.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /home/xwei12/src/cuda-swift/.build/debug -enable-testing -g -module-cache-path /home/xwei12/src/cuda-swift/.build/debug/ModuleCache -D SWIFT_PACKAGE -Xcc -I/usr/local/cuda/include -Xcc -fmodule-map-file=/home/xwei12/src/cuda-swift/Packages/CCUDA-1.4.0/module.modulemap -emit-module-doc-path /home/xwei12/src/cuda-swift/.build/debug/CUDARuntime.build/Value~partial.swiftdoc -Onone -parse-as-library -module-name CUDARuntime -emit-module-path /home/xwei12/src/cuda-swift/.build/debug/CUDARuntime.build/Value~partial.swiftmodule -emit-dependencies-path /home/xwei12/src/cuda-swift/.build/debug/CUDARuntime.build/Value.d -emit-reference-dependencies-path /home/xwei12/src/cuda-swift/.build/debug/CUDARuntime.build/Value.swiftdeps -num-threads 8 -o /home/xwei12/src/cuda-swift/.build/debug/CUDARuntime.build/Value.swift.o
1.  While emitting SIL for 'withUnsafeMutableDevicePointer' at /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift:62:21
2.  While verifying SIL function @_TFV11CUDARuntime11DeviceValue30withUnsafeMutableDevicePointerurfzFzGVS_26UnsafeMutableDevicePointerx_qd__qd__ for 'withUnsafeMutableDevicePointer' at /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift:62:21
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
SIL verification failed: function_ref inside fragile function cannot reference a private or hidden symbol: (SingleFunction && RefF->isExternalDeclaration()) || RefF->hasValidLinkageForFragileRef()
Verifying instruction:
->   // function_ref DeviceArray.cowBuffer.getter
  %8 = function_ref @_TFV11CUDARuntime11DeviceArraygP33_9E6CAD72F382D3C059191A890F038D949cowBufferGCS_P33_9E6CAD72F382D3C059191A890F038D9417DeviceArrayBufferx_ : $@convention(method) <τ_0_0> (@inout DeviceArray<τ_0_0>) -> @owned DeviceArrayBuffer<τ_0_0>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":146:25, scope 0 // user: %9
     %9 = apply %8<Element>(%5) : $@convention(method) <τ_0_0> (@inout DeviceArray<τ_0_0>) -> @owned DeviceArrayBuffer<τ_0_0>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":146:25, scope 0 // users: %14, %21, %10
In function:
sil_scope 1 { loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":144:26 parent @_TFV11CUDARuntime11DeviceArray30withUnsafeMutableDevicePointerurfzFzGVS_26UnsafeMutableDevicePointerx_qd__qd__ : $@convention(method) <τ_0_0><τ_1_0> (@owned @callee_owned (UnsafeMutableDevicePointer<τ_0_0>) -> (@out τ_1_0, @error Error), @inout DeviceArray<τ_0_0>) -> (@out τ_1_0, @error Error) }
sil_scope 2 { loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":147:5 parent 1 }

// DeviceArray.withUnsafeMutableDevicePointer<A> ((UnsafeMutableDevicePointer<A>) throws -> A1) throws -> A1
sil [fragile] [always_inline] @_TFV11CUDARuntime11DeviceArray30withUnsafeMutableDevicePointerurfzFzGVS_26UnsafeMutableDevicePointerx_qd__qd__ : $@convention(method) <Element><Result> (@owned @callee_owned (UnsafeMutableDevicePointer<Element>) -> (@out Result, @error Error), @inout DeviceArray<Element>) -> (@out Result, @error Error) {
// %0                                             // user: %12
// %1                                             // users: %24, %17, %12, %7, %3
// %2                                             // users: %22, %15, %6
bb0(%0 : $*Result, %1 : $@callee_owned (UnsafeMutableDevicePointer<Element>) -> (@out Result, @error Error), %2 : $*DeviceArray<Element>):
  debug_value %1 : $@callee_owned (UnsafeMutableDevicePointer<Element>) -> (@out Result, @error Error), let, name "body", argno 1, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":145:12, scope 1 // id: %3
  %4 = alloc_box $DeviceArray<Element>, var, name "self", argno 2, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":144:26, scope 1 // users: %23, %16, %5
  %5 = project_box %4 : $@box DeviceArray<Element>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":144:26, scope 1 // users: %22, %15, %9, %6
  copy_addr %2 to [initialization] %5 : $*DeviceArray<Element>, scope 1 // id: %6
  strong_retain %1 : $@callee_owned (UnsafeMutableDevicePointer<Element>) -> (@out Result, @error Error), loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":146:20, scope 2 // id: %7
  // function_ref DeviceArray.cowBuffer.getter
  %8 = function_ref @_TFV11CUDARuntime11DeviceArraygP33_9E6CAD72F382D3C059191A890F038D949cowBufferGCS_P33_9E6CAD72F382D3C059191A890F038D9417DeviceArrayBufferx_ : $@convention(method) <τ_0_0> (@inout DeviceArray<τ_0_0>) -> @owned DeviceArrayBuffer<τ_0_0>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":146:25, scope 2 // user: %9
  %9 = apply %8<Element>(%5) : $@convention(method) <τ_0_0> (@inout DeviceArray<τ_0_0>) -> @owned DeviceArrayBuffer<τ_0_0>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":146:25, scope 2 // users: %14, %21, %10
  %10 = ref_element_addr %9 : $DeviceArrayBuffer<Element>, #DeviceArrayBuffer.baseAddress, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":146:35, scope 2 // user: %11
  %11 = load %10 : $*UnsafeMutableDevicePointer<Element>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":146:35, scope 2 // user: %12
  try_apply %1(%0, %11) : $@callee_owned (UnsafeMutableDevicePointer<Element>) -> (@out Result, @error Error), normal bb1, error bb2, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":146:46, scope 2 // id: %12

bb1(%13 : $()):                                   // Preds: bb0
  strong_release %9 : $DeviceArrayBuffer<Element>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":146:46, scope 2 // id: %14
  copy_addr %5 to %2 : $*DeviceArray<Element>, scope 2 // id: %15
  strong_release %4 : $@box DeviceArray<Element>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":147:5, scope 2 // id: %16
  strong_release %1 : $@callee_owned (UnsafeMutableDevicePointer<Element>) -> (@out Result, @error Error), loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":147:5, scope 2 // id: %17
  %18 = tuple (), loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":147:5, scope 2 // user: %19
  return %18 : $(), loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":146:9, scope 2 // id: %19

// %20                                            // user: %25
bb2(%20 : $Error):                                // Preds: bb0
  strong_release %9 : $DeviceArrayBuffer<Element>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":147:5, scope 2 // id: %21
  copy_addr %5 to %2 : $*DeviceArray<Element>, scope 2 // id: %22
  strong_release %4 : $@box DeviceArray<Element>, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":147:5, scope 2 // id: %23
  strong_release %1 : $@callee_owned (UnsafeMutableDevicePointer<Element>) -> (@out Result, @error Error), loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":147:5, scope 2 // id: %24
  throw %20 : $Error, loc "/home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift":146:46, scope 2 // id: %25
}

0  swift           0x000000000334f818 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift           0x000000000334e016 llvm::sys::RunSignalHandlers() + 54
2  swift           0x0000000003350346
3  libpthread.so.0 0x00007f8e2c4cc3d0
4  libc.so.6       0x00007f8e2ae14418 gsignal + 56
5  libc.so.6       0x00007f8e2ae1601a abort + 362
6  swift           0x0000000000d008d6
7  swift           0x0000000000d05c60
8  swift           0x0000000000d01edb
9  swift           0x0000000000cfd83e swift::SILFunction::verify(bool) const + 5774
10 swift           0x00000000009379e8
11 swift           0x0000000000940e9d
12 swift           0x0000000000937771
13 swift           0x00000000009dcd4c
14 swift           0x00000000009dc79d
15 swift           0x000000000093dc0b
16 swift           0x000000000093e912 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 482
17 swift           0x000000000093eea6 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 118
18 swift           0x00000000007def4d
19 swift           0x00000000007dae11 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2833
20 swift           0x00000000007a78ab main + 2603
21 libc.so.6       0x00007f8e2adff830 __libc_start_main + 240
22 swift           0x00000000007a5429 _start + 41
Stack dump:
0.  Program arguments: /home/xwei12/.swiftenv/versions/3.0.1-PREVIEW-3/usr/bin/swift -frontend -c /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Memory.swift /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Value.swift -primary-file /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Error.swift /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Device.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /home/xwei12/src/cuda-swift/.build/debug -enable-testing -g -module-cache-path /home/xwei12/src/cuda-swift/.build/debug/ModuleCache -D SWIFT_PACKAGE -Xcc -I/usr/local/cuda/include -Xcc -fmodule-map-file=/home/xwei12/src/cuda-swift/Packages/CCUDA-1.4.0/module.modulemap -emit-module-doc-path /home/xwei12/src/cuda-swift/.build/debug/CUDARuntime.build/Array~partial.swiftdoc -Onone -parse-as-library -module-name CUDARuntime -emit-module-path /home/xwei12/src/cuda-swift/.build/debug/CUDARuntime.build/Array~partial.swiftmodule -emit-dependencies-path /home/xwei12/src/cuda-swift/.build/debug/CUDARuntime.build/Array.d -emit-reference-dependencies-path /home/xwei12/src/cuda-swift/.build/debug/CUDARuntime.build/Array.swiftdeps -num-threads 8 -o /home/xwei12/src/cuda-swift/.build/debug/CUDARuntime.build/Array.swift.o
1.  While emitting SIL for 'withUnsafeMutableDevicePointer' at /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift:144:21
2.  While verifying SIL function @_TFV11CUDARuntime11DeviceArray30withUnsafeMutableDevicePointerurfzFzGVS_26UnsafeMutableDevicePointerx_qd__qd__ for 'withUnsafeMutableDevicePointer' at /home/xwei12/src/cuda-swift/Sources/CUDARuntime/Array.swift:144:21
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
error: exit(1): /home/xwei12/.swiftenv/versions/3.0.1-PREVIEW-3/usr/bin/swift-build-tool -f /home/xwei12/src/cuda-swift/.build/debug.yaml
@belkadan
Copy link
Contributor

This is correct behavior, since you can't inline a reference to a private thing into another module. We'll have a diagnostic once we have a proper inlining model, but @inline(__always) isn't for public use.

@lilyball
Copy link
Mannequin

lilyball mannequin commented Mar 6, 2017

I just hit this error too, but my @inline(__always) functions aren't public, so they can't possibly be inlined into another module. Most are internal, and a couple are local functions nested inside other functions. So why are these causing problems? It also only is a problem when compiling on Linux, it works just fine on Apple platforms.

@lilyball
Copy link
Mannequin

lilyball mannequin commented Mar 6, 2017

Turns out I can actually keep most of them (it still works on any private function). But it doesn't work for internal functions (?!?) and it doesn't work for nested local functions, which is pretty weird.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
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. compiler The Swift compiler in itself 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

3 participants