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-11441] Compiler crash on Property Wrapper #53842

Closed
swift-ci opened this issue Sep 10, 2019 · 3 comments
Closed

[SR-11441] Compiler crash on Property Wrapper #53842

swift-ci opened this issue Sep 10, 2019 · 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 property wrappers Feature: property wrappers

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-11441
Radar rdar://problem/55229985
Original Reporter linqingmo (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

Xcode 11.0 Beta7

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

md5: 691f4344e4b3e8f946bd79b76cdb885d

duplicates:

  • SR-11062 Compiler crashes when using attribute syntax with a property wrapper

Issue Description:

struct Key {
    let key: String
    let localizedKey: String?
    
    init(key: String, localizedKey: String? = nil) {
        self.key = key
        self.localizedKey = localizedKey
    }
}


@propertyWrapper
class Wrapper<Value> {
    var wrappedValue: Value
    let key: Key
    init(wrappedValue: Value, key: Key) {
        self.wrappedValue = wrappedValue
        self.key = key
    }
}


class Test {
    @Wrapper(key: Key(key: "a")) var a = 3 // crash
//    @Wrapper(key: Key(key: "a", localizedKey: "localize_a")) var a = 3
}

error message is

1.  While silgen constructor initializer SIL function "@$s2UI4TestCACycfc".
 for 'init()' (at /Users/harry/dev/swift/UI/Sources/UI/Form/Row.swift:62:7)
0  swift                    0x000000010d3ba013 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x000000010d3b97e6 SignalHandler(int) + 358
2  libsystem_platform.dylib 0x00007fff7f9c9b5d _sigtramp + 29
3  libsystem_platform.dylib 0x00000000ffffffff _sigtramp + 2153997503
4  swift                    0x000000010944f2d6 void llvm::function_ref<void (swift::Expr*)>::callback_fn<swift::Lowering::SILGenFunction::emitMemberInitializers(swift::DeclContext*, swift::VarDecl*, swift::NominalTypeDecl*)::$_2>(long, swift::Expr*) + 38
5  swift                    0x000000010944e773 maybeEmitPropertyWrapperInitFromValue(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::VarDecl*, swift::Lowering::RValue&&, llvm::function_ref<void (swift::Expr*)>) + 403
6  swift                    0x000000010944eff4 swift::Lowering::SILGenFunction::emitMemberInitializers(swift::DeclContext*, swift::VarDecl*, swift::NominalTypeDecl*) + 1364
7  swift                    0x0000000109451bef swift::Lowering::SILGenFunction::emitClassConstructorInitializer(swift::ConstructorDecl*) + 3951
8  swift                    0x0000000109401ea6 swift::Lowering::SILGenModule::emitConstructor(swift::ConstructorDecl*) + 3878
9  swift                    0x00000001094f40c4 (anonymous namespace)::SILGenType::emitType() + 1172
10 swift                    0x000000010940ad6d swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 77
11 swift                    0x0000000109409fb6 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 1238
12 swift                    0x000000010940ba16 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 1238
13 swift                    0x000000010900f8b9 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 28345
14 swift                    0x00000001090051f4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6820
15 swift                    0x0000000108f92763 main + 1219
16 libdyld.dylib            0x00007fff7f7de3d5 start + 1
error: Segmentation fault: 11 (in target 'UI' from project 'UI')
@belkadan
Copy link
Contributor

@swift-ci create

@DougGregor
Copy link
Member

Good news! It's the same issue as SR-11062, for which we have a fix now.

@swift-ci
Copy link
Collaborator Author

Comment by Xuetao Jing (JIRA)

Xcode Version 11.0 (11A420a) has this question too.

@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 property wrappers Feature: property wrappers
Projects
None yet
Development

No branches or pull requests

4 participants