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-15881] Segmentation fault: 11 with property wrappers #58146

Open
swift-ci opened this issue Feb 18, 2022 · 0 comments
Open

[SR-15881] Segmentation fault: 11 with property wrappers #58146

swift-ci opened this issue Feb 18, 2022 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-15881
Radar None
Original Reporter rserentill (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 2a92bb750158b3aee5d9f809981e5c6c

Issue Description:

Hello there!

I have the following code to define a property wrapper (this property wrapper is in separated module):

@propertyWrapper public struct ViewRemovable<T: UIView> {
  public var wrappedValue: T? {
    didSet {
      oldValue?.removeFromSuperview()
    }
  }

  public init(_ value: T? = nil) {
    wrappedValue = value
  }
}

And I was using it like this (it worked fine):

final class ContentItemCell: UICollectionViewCell {
  ...
  @ViewRemovable private var content: UIView?
  ...
}

But now I need to change it to this:

@ViewRemovable private var content: ContentKind.Content?

`ContentKind` is an enum:

enum ContentKind {
  typealias Content = UIView & Accessible
  ...
}

`Accessible` is a custom protocol.

The compiler is crashing with `Segmentation fault: 11` error:

1.  Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
2.  
3.  Contents of /var/folders/kv/ccbtkwmn43l_zfmpqf7n0dgw0000gn/T/TemporaryDirectory.PlvIvz/sources-1:
---
...
---
4.  While emitting IR SIL function "@$s3App15ContentItemCellC8_content33_7107E058EA79EE0E7EE1B0F7EBA09011LL12UIComponents13ViewRemovableVy9Protocols10Accessible_So6UIViewCXcGvpfi".
 for expression at [/Users/roger/Developer/iOS/ios-newsstand/app/App/Components/Store Collection View/Views/ContentItemCell.swift:25:4 - line:25:4] RangeText=""
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           0x0000000114641c27 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-frontend           0x0000000114640bb8 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x0000000114642236 SignalHandler(int) + 278
3  libsystem_platform.dylib 0x00007ff81ea51e2d _sigtramp + 29
4  libsystem_platform.dylib 0x00007ff7b0889e50 _sigtramp + 18446744071862190144
5  swift-frontend           0x000000011443c9ac llvm::ConstantExpr::getCast(unsigned int, llvm::Constant*, llvm::Type*, bool) + 844
6  swift-frontend           0x000000010f7eb529 llvm::IRBuilderBase::CreateCast(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&) + 169
7  swift-frontend           0x000000010facc17c emitCastToSubstSchema(swift::irgen::IRGenFunction&, swift::irgen::Explosion&, swift::irgen::ExplosionSchema const&, swift::irgen::Explosion&) + 348
8  swift-frontend           0x000000010faca93f swift::irgen::CallEmission::emitToExplosion(swift::irgen::Explosion&, bool) + 3055
9  swift-frontend           0x000000010fca1a19 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 4409
10 swift-frontend           0x000000010fc8135f swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 10335
11 swift-frontend           0x000000010fb2ba77 swift::irgen::IRGenerator::emitGlobalTopLevel(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) + 1607
12 swift-frontend           0x000000010fc4fde0 swift::performIRGeneration(swift::ModuleDecl*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, llvm::GlobalVariable**) + 1872
13 swift-frontend           0x000000010f75e5ca performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 2346
14 swift-frontend           0x000000010f7506d7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 14743
15 swift-frontend           0x000000010f690b08 main + 1032
16 dyld                     0x00000001265bd4fe start + 462
error: Segmentation fault: 11 (in target 'App' from project 'App')
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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.
Projects
None yet
Development

No branches or pull requests

1 participant