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-11492] Property Wrapper, a compiler crash with default param #53892

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

[SR-11492] Property Wrapper, a compiler crash with default param #53892

swift-ci opened this issue Sep 19, 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-11492
Radar None
Original Reporter linqingmo (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

Xcode 11.3

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

md5: c0cfa5ea501440f0de8bf87a0f9dc7c4

duplicates:

  • SR-11059 Abort 6: Property wrapper with default value in initialiser

Issue Description:

@propertyWrapper
public final class Field<Value> {
    public let key: String
    public let codingKey: String


    public init(wrappedValue: Value, key: String, codingKey: String = "") {
        self.key = key
        self.wrappedValue = wrappedValue
        self.codingKey = codingKey
    }


    public var wrappedValue: Value
}


class Test {
    @Field(key: "test") var a: Int = 3
}

error message:

1.  While silgen emitStoredPropertyInitialization SIL function "@$s19testPropertyWrapper4TestC2_a33_3EDFC203798246EBE1D146DBAA6300BALLAA5FieldCySiGvpfi".
 for expression at [/Users/harry/dev/ios/FiedoraSport/testPropertyWrapper/testPropertyWrapper/ViewController.swift:26:6 - line:26:23] RangeText="Field(key: "test""
2.  While verifying SIL function "@$s19testPropertyWrapper4TestC2_a33_3EDFC203798246EBE1D146DBAA6300BALLAA5FieldCySiGvpfi".
 for expression at [/Users/harry/dev/ios/FiedoraSport/testPropertyWrapper/testPropertyWrapper/ViewController.swift:26:6 - line:26:23] RangeText="Field(key: "test""
0  swift                    0x000000010f39d165 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x000000010f39c455 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x000000010f39d748 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff7a9aeb5d _sigtramp + 29
4  swift                    0x0000000111694f10 llvm::dbgs()::thestrm + 0
5  libsystem_c.dylib        0x00007fff7a8686a6 abort + 127
6  swift                    0x000000010c36e9d8 (anonymous namespace)::SILVerifier::_require(bool, llvm::Twine const&, std::__1::function<void ()> const&) + 616
7  swift                    0x000000010c381e20 swift::SILInstructionVisitor<(anonymous namespace)::SILVerifier, void>::visit(swift::SILInstruction*) + 67248
8  swift                    0x000000010c3704fc (anonymous namespace)::SILVerifier::visitSILBasicBlock(swift::SILBasicBlock*) + 1484
9  swift                    0x000000010c36b1a7 swift::SILFunction::verify(bool) const + 7303
10 swift                    0x000000010be1f35d swift::Lowering::SILGenModule::postEmitFunction(swift::SILDeclRef, swift::SILFunction*) + 205
11 swift                    0x000000010be27c06 swift::Lowering::SILGenModule::emitStoredPropertyInitialization(swift::PatternBindingDecl*, unsigned int)::$_6::operator()(swift::SILFunction*) const + 422
12 swift                    0x000000010be21ace swift::Lowering::SILGenModule::emitStoredPropertyInitialization(swift::PatternBindingDecl*, unsigned int) + 510
13 swift                    0x000000010bef136d (anonymous namespace)::SILGenType::emitType() + 381
14 swift                    0x000000010bef11e9 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 25
15 swift                    0x000000010be23db6 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 822
16 swift                    0x000000010be24c15 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 293
17 swift                    0x000000010be25136 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&) + 38
18 swift                    0x000000010bb49be3 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 8291
19 swift                    0x000000010bb46c5a swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3002
20 swift                    0x000000010baef708 main + 696
21 libdyld.dylib            0x00007fff7a7c33d5 start + 1
22 libdyld.dylib            0x0000000000000047 start + 2240007283
error: Abort trap: 6 (in target 'testPropertyWrapper' from project 'testPropertyWrapper')
@swift-ci
Copy link
Collaborator Author

Comment by LinQingmo (JIRA)

Regression?

Xcode 11.3 crash again.

1.  While emitting IR SIL function "@$s5fssad4TestCACycfc".
 for 'init()' (at /Users/harry/dev/ios/fssad/fssad/main.swift:28:7)
0  swift                    0x0000000114176a63 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x0000000114176236 SignalHandler(int) + 358
2  libsystem_platform.dylib 0x00007fff71816b1d _sigtramp + 29
3  libsystem_platform.dylib 0x00007fe95b9203e8 _sigtramp + 3926956264
4  libsystem_c.dylib        0x00007fff716eca1c abort + 120
5  libsystem_malloc.dylib   0x00007fff717dcd20 turn_on_stack_logging + 0
6  libsystem_malloc.dylib   0x00007fff717dcade malloc_report + 151
7  libsystem_malloc.dylib   0x00007fff717d9920 realloc + 312
8  swift                    0x000000010fe8facd swift::irgen::SingleScalarTypeInfo<(anonymous namespace)::ClassTypeInfo, swift::irgen::ReferenceTypeInfo>::getSchema(swift::irgen::ExplosionSchema&) const + 157
9  swift                    0x00000001100051fe swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 35646
10 swift                    0x000000010fff9b4a swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9834
11 swift                    0x000000010fea4c50 swift::irgen::IRGenerator::emitGlobalTopLevel() + 1712
12 swift                    0x000000010ffd68c5 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1189
13 swift                    0x000000010fdc1a01 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 36673
14 swift                    0x000000010fdb52b4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6820
15 swift                    0x000000010fd427b3 main + 1219
16 libdyld.dylib            0x00007fff716152e5 start + 1
17 libdyld.dylib            0x0000000000000047 start + 2392763747
error: Abort trap: 6

@theblixguy
Copy link
Collaborator

Works fine on master. Can you try using a 5.2 snapshot?

@swift-ci
Copy link
Collaborator Author

Comment by LinQingmo (JIRA)

5.2 snapshot works fine. close it.

@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

3 participants