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-11229] Setting a property with @Published in a method in some complex type makes Swift compiler crashes #53630

Closed
pitiphong-p opened this issue Jul 30, 2019 · 3 comments
Assignees
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

Comments

@pitiphong-p
Copy link
Contributor

Previous ID SR-11229
Radar rdar://problem/53712388
Original Reporter @pitiphong-p
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

Xcode 11 beta 4 and 5

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee @pitiphong-p
Priority Medium

md5: e19870a94a8f79730b60cf520dc43da1

Issue Description:

I have a complicated generic type with @published property. When I build the project, the complier crashes with Segmentation Fault error.

I attached a reproducible project


Stack dump:

0. Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/pitiphong.p/Downloads/SwfitCrash/SwfitCrash/SearchDataViewController.swift /Users/pitiphong.p/Downloads/SwfitCrash/SwfitCrash/AppDelegate.swift /Users/pitiphong.p/Downloads/SwfitCrash/SwfitCrash/SceneDelegate.swift -emit-module-path /Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/Objects-normal/x86_64/SearchDataViewController~partial.swiftmodule -emit-module-doc-path /Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/Objects-normal/x86_64/SearchDataViewController~partial.swiftdoc -serialize-diagnostics-path /Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/Objects-normal/x86_64/SearchDataViewController.dia -emit-dependencies-path /Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/Objects-normal/x86_64/SearchDataViewController.d -emit-reference-dependencies-path /Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/Objects-normal/x86_64/SearchDataViewController.swiftdeps -target x86_64-apple-ios13.0-simulator -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.0.sdk -I /Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Products/Debug-iphonesimulator -F /Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Products/Debug-iphonesimulator -enable-testing -g -module-cache-path /Users/pitiphong.p/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc /Users/pitiphong.p/Downloads/SwfitCrash -enable-anonymous-context-mangled-names -Xcc -I/Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/SwfitCrash-generated-files.hmap -Xcc -I/Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/SwfitCrash-own-target-headers.hmap -Xcc -I/Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/SwfitCrash-all-target-headers.hmap -Xcc -iquote -Xcc /Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/SwfitCrash-project-headers.hmap -Xcc -I/Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/DerivedSources-normal/x86_64 -Xcc -I/Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/DerivedSources/x86_64 -Xcc -I/Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/DerivedSources -Xcc -DDEBUG=1 -module-name SwfitCrash -o /Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Build/Intermediates.noindex/SwfitCrash.build/Debug-iphonesimulator/SwfitCrash.build/Objects-normal/x86_64/SearchDataViewController.o -index-store-path /Users/pitiphong.p/Library/Developer/Xcode/DerivedData/SwfitCrash-brrbdomvzwpxrqdkeridgfntmajr/Index/DataStore -index-system-modules 

1. While emitting IR SIL function "@$s10SwfitCrash24SearchDataViewControllerC06resulteF0ACyxGqd___tc0D0Qyd__RszSo06UIViewF0CRbd__AA0c10ResultListeF0Rd__lufc".

 for 'init(resultViewController:)' (at /Users/pitiphong.p/Downloads/SwfitCrash/SwfitCrash/SearchDataViewController.swift:139:3)

0  swift                    0x00000001053360e3 PrintStackTraceSignalHandler(void\*) + 51

1  swift                    0x00000001053358b6 SignalHandler(int) + 358

2  libsystem_platform.dylib 0x00007fff5b8d0b5d _sigtramp + 29

3  libsystem_platform.dylib 0x00007fa78203fc40 _sigtramp + 645329152

4  swift                    0x0000000100ffd988 swift::irgen::emitArchetypeTypeMetadataRef(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::ArchetypeType>, swift::irgen::DynamicMetadataRequest) + 984

5  swift                    0x0000000101217345 emitDirectTypeMetadataRef(swift::irgen::IRGenFunction&, swift::CanType, swift::irgen::DynamicMetadataRequest) + 197

6  swift                    0x000000010121bbe5 swift::irgen::IRGenFunction::emitTypeMetadataRef(swift::CanType, swift::irgen::DynamicMetadataRequest) + 149

7  swift                    0x000000010121bfe1 void llvm::function_ref<void (unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>)>::callback_fn<(anonymous namespace)::GenericArguments::collect(swift::irgen::IRGenFunction&, swift::CanType)::'lambda'(unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>)>(long, unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>) + 113

8  swift                    0x000000010115dc2f swift::irgen::GenericTypeRequirements::enumerateFulfillments(swift::irgen::IRGenModule&, swift::SubstitutionMap, llvm::function_ref<void (unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>)>) + 335

...

@belkadan
Copy link
Contributor

@swift-ci create

@hborla
Copy link
Member

hborla commented May 26, 2021

This is fixed in Swift 5.5. Could you please verify using a 5.5 development toolchain from https://swift.org/download/#snapshots? Thank you!

@pitiphong-p
Copy link
Contributor Author

Verified that this issue is resolved

@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
Projects
None yet
Development

No branches or pull requests

4 participants